Using External Data Fields for Portfolio Management

Author: Optuma Team Last updated: Jul 18, 2023 13:30

Overview

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 = CurrentValue  PurchasePrice ;
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

Setting up Watchlist Summary Headers

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