Skip to content

Using External Data Fields for Portfolio Management

By Optuma Team · Updated 2023-07-18

The following will show you how to use EDFs to keep track of your portfolio by entering your Buy Price and Quantity information:

Watch Lists

You can use scripting to generate a new column to display your Profit / Loss details.

Watch Lists

The script used to generate the Profit Loss column in this example:

V1 = DATAFIELD(FEED=UD, FIELD=Buy_Price) ;
V2 = DATAFIELD(FEED=UD, FIELD=Quantity) ;
PurchasePrice = V1 * V2 ;
CurrentValue = V2 * CLOSE() ;
ProfitLoss = CurrentValuePurchasePrice ;
ProfitLoss

Profit / Loss can also be displayed as a percentage using the same EDF values with a small adjustment to the script formula:

V1 = DATAFIELD(FEED=UD, FIELD=Buy_Price) ;
V2 = DATAFIELD(FEED=UD, FIELD=Quantity) ;
PurchasePrice = V1 * V2 ;
CurrentValue = V2 * CLOSE() ;
(CurrentValue / PurchasePrice) – 1

Be sure to set the column in the Watchlist to display as a percentage:

Watch Lists Custom Labels

The Watch list Custom Labels feature can be used to make the Profits easier to distinguish from the losses by having values greater than zero show with a green background, and values less than zero display with a red background.

Watch Lists Custom Labels

As new data comes in each day, the Profit Loss column will update automatically in the Watchlist.

The above example covers basic items you would include in a Portfolio, however you can expand on this using EDFs to add additional items for Brokerage, etc.

Watch Lists Custom Labels

Once the Watchlist has been set up a Summary row can be added under the Properties to display for selected columns, such as Sum, Count, Average, etc:

Watch List Summary Headers

Choose which categories of cookies you allow. Strictly-necessary cookies are always on. You can change this any time via the "Cookie Settings" link in the footer.

  • Functional

    Remember preferences like dismissed banners and your dark-mode choice.

  • Analytics

    Help us understand how the site is used so we can improve it.

  • Marketing

    Measure our advertising and help us reach people who may be interested in Optuma.