Hello
Having completed the Momentum Trading Strategies course on Quantra, I have added a pipeline to the strategy defined in Andreas Clenow book Trading Evolved. The strategy can be found at the following Github repository.
After runnning a few backtests on the code, I have decided to paper trade the strategy to see how valid the proposed trading idea is in the live markets. However, I run into the following issue when I run the code. As can be seen from the image attached in the link, the validation error reads: requested number of assets exceeds max allowed 100.
How would I go about reducing the requested number of assets produced by the pipeline? Also, thank you for updating factor demo strategies on github; I look forward to experimenting with them!
The issue here is that most brokers have a limit on the number of stocks you can fetch data for at the same time. It ranges from 30 to about 200 usually - it is set at 100 for Alpaca. You have a data fetch call in your strategy (data.history or data.current) that exceeds this limit. Pipeline APIs are used to filter and reduce the asset universe. Data fetch calls are then expected to be called on this reduced universe. Perhaps you are not using proper filtering in your pipeline or perhaps it is a too broad filter that passes too many assets? One way to handle this is to compute your strategy factor(s) in pipeline itself, along with appropriate filters. Please see the strategies in the blueshift demo repositories for some ideas that may work for you!
If you need further help, can you please share a minimum version of your strategy that can reproduce this error to blueshift-support@quantinsti.com
Hello
Thank you for your response sir. So by computing the factors within the pipeline, I reduce the number of stocks I fetch data for? Is this what the pipeline in the cross-sectional momentum strategy (from Blueshift Demo Strategies) does, or does this procedure look like something else?
Kind Regards
The same or similar query was raised in the blueshift support mailbox and it was answered there. Let us know if you would need any other clarity.
Thanks!