Imported Data Series & Stock Factors

How to import your own time series into Portfolio123

Marco Salerno
Written by Marco SalernoLast update 1 year ago

Importing Your Series

Data Series is a list of dates and their associated values. Importing your own data series is easy:

  1. Click on Research→Imported Data Series then New → Data Series.

  2. Select the file from your hard drive (CSV). First column is the date, second the value.

  3. Select the Date Format from the dropdown. For example yyyy-mm-dd.

  4. Select other options like the decimal format and whether a header row exists.

  5. Click upload. If there are errors they will be reported including where they occur.

  6. Click the Save icon indicated by the arrow.

  7. Verify your series by clicking on the Chart tab.

Below is the result of uploading a series for a file called IBM_close.csv.

Adding/Updating Your Series

To add or update data click on the series and select the file with the new data. You can choose what happens to the existing data from the Existing Data dropdown:

  1. Overwrite will update values on the same date

  2. Skip will skip the values on the same date

  3. Delete will delete all existing data first, then add the new data

Using Your Series

Imported Series can be used in formulas of all the main components like Ranking Systems, Screens, and Portfolio Strategies using the GetSeries("series name") function.

So, for example, let’s say you only want to check if the FRED data for the US leading index is 0.5% or higher. One way to do this would be to upload the USSLIND data from FRED in a series with the same name. Then in a rule, you can check like this:

Close( 0, GetSeries("USSLIND") ) > 0.5

Or if you want to know if USSLIND is above it's SMA(10) you would write:

Close( 0, GetSeries("USSLIND") ) > SMA( 10, GetSeries("USSLIND") )

Stock Factors

 a Stock Factor is a list of dates and tickers and their associated values. You can import them as CSV files.

Stock Factors have the following format:

  • CSV file should have three columns, with headers, containing dates, keys, and values.

  • Column Separator: choose the one matching your file; comma, semicolon and tab supported

  • Following are the acceptable values for the header row,

    • date – for the date column.

    • value – for the value column.

    • id/ticker/gvkey/cusip/cik – for the key column.

  • Date column: use any date format available in the Date Format dropdown.

  • Value column: must be a valid number (both dot and comma decimal separators supported via Decimal Separator dropdown); case-insensitive matches of NA, NaN, and NULL will be treated as NA.

  • Key column: must specify either a Portfolio123 StockID, current ticker, GVKey, current CUSIP, or CIK, matching the identification specified in the header.

  • Anything specified after the third column will be ignored.

 

Options for handling errors and duplicates in Data Series and Stock Factor CSV files:

  • Existing Data

    • overwrite – use uploaded value if data point matches a previously stored one

    • skip – skip uploaded data point if it matches a previously stored one

    • delete – delete previously stored data points

  • On Error: use continue if you want to ignore rows with errors

  • On Duplicates: use continue if you want to ignore duplicate (same date) rows; last occurring duplicate row's value will be used

Using your Stock Factor

The stock factor tool allows you to import outside data about tickers (both stock and ETF). You can use this, for example, to import an ETF’s historical holdings (by assigning the value 1 to held tickers and 0 to remove them if they’re no longer held), the executive compensation of companies, or alternative data sources for adjusted EBITDA if you can get it. You can upload the historical Zacks ranks of companies (if you can get that) to see how well they’d backtest. If you can get satellite images of parking lots, you can upload the number of shoppers visiting public retail companies.

The tool works just like a custom formula, except that it has two dollar signs in front of the name instead of one. So you can use stock factors in screens, ranking systems, and simulations—everywhere you can use a custom formula. If a ticker changes, you don’t have to reload the file: all the data is associated with the underlying security.

For both data series and stock factors, the last date remains in effect until a new value is put at a subsequent date. For example, if your input is 2019-09-09,IBM,1, IBM’s value on that factor will remain 1 until you input a new value, e.g. 2019-12-09,IBM,0 or 2019-12-09,IBM,NA.

If you’re using old tickers, you may get an error message. You can search for the new ticker for a company by putting the company name into the Advanced Stock Search.

Did this answer your question?