We are now exposing Stock IDs

We have decided to expose our stock IDs. This will make it easier for users to create partial universes for backtesting and out-of-sample testing. The command is simply StockID. Each ticker in our database has a unique numeric ID, and this command exposes it. The command works both for stocks and for ETFs.

To create a small universe for an out-of-sample test, use the command Mod (StockID, X) = Y, where Y < X and X is a positive integer. If X = 4, you’ll be reserving one fourth of your universe for the out-of-sample test; if X = 9, you’ll be reserving one ninth, and so on. To test on four different more-or-less random universes, use Mod (StockID, 4) = 0, Mod (StockID, 4) = 1, Mod (StockID, 4) = 2, and Mod (StockID, 4) = 3 in your four universes.

I’m sure users will come up with other creative uses for these IDs.

Thank you Yuval.

Could you please update the reference with your practical example (so that we do not have to look for this thread in the forum)?
At the moment, the reference for StockID is only ‘Returns the internal ID of the current stock or ETF’

Please add →
“To create a small universe for an out-of-sample test, use the command Mod (StockID, X) = Y, where Y < X and X is a positive integer. If X = 4, you’ll be reserving one fourth of your universe for the out-of-sample test; if X = 9, you’ll be reserving one ninth, and so on. To test on four different more-or-less random universes, use Mod (StockID, 4) = 0, Mod (StockID, 4) = 1, Mod (StockID, 4) = 2, and Mod (StockID, 4) = 3 in your four universes.”

Thank you

Jerome

Yuval - is this a guaranteed permanent ID?

Then Mod (StockID, 1) = 0 means backtesting on the full universe.

Yes indeed. Tickers can change; Stock IDs remain the same.

Yuval, this rule only reduces the number of stocks in the universe for backtesting, it is not giving you an out-of-sample test. The sample from which to select stocks from is just made smaller. Similar to “evenID” which reduces the universe by 50%.

Mod (StockID, 2) = 0 or Mod (StockID, 2) = 1 will also half the universe.

Georg, I think the idea is to develop in one universe (e.g. Mod (StockID, 2) = 0) and then test in the other (e.g. Mod (StockID, 2) = 1).

Walter

cool, Thank you!!!

Will this achieve much of the same if used on the “United States” universe etc: FOrder(“Random”,#Previous) = 3000, in a screen backtest?

Your rule would randomly select 3000 stocks from those that passed the previous rules in your screen. That is not the same result as the rules mentioned earlier in the thread which would result in consistent universes. If you run those formulas multiple times, the same stocks pass the rule each time.

I think you would want to use ‘<=’ instead of ‘=’ since using ‘=’ would return only 1 stock (the one with random number = 3000).
Like this → FOrder(“Random”,#Previous) <= 3000

The Random function is useful for testing the robustness of your system. Another way to use it would be to randomly eliminate a percentage of the stocks from your universe. This rule would eliminate approximately 50% of the stocks → Random < .5