Hi everyone, is there a good example out there of updating an indicator that requires a TradeBar for update (like Average True Range) but doesn't require calling History every time? I'm using ATR as a filter in my coarse universe selection, but I don't have access to all the elements of a TradeBar (ie, high, open, low) in the universe data in CoarseFilterFunction. Hence, I'm calling History for every security to get 1 row of historical data in order to create a TradeBar to send to the Update method to get the current ATR for each security. This looks to be very costly and is slowing down my backtests. I'm thinking a RollingWindow could be a solution, but can't figure it out. If there is an example out there or some sample code that could illustrate how this is done, please share.
Thanks,
Chetan
Chetan Prabhu
In case this was confusing, I'm basically trying to use ATR in my filters in Coarse selection and need an updated ATR for every day as part of universe selection. What's the best way to do this?Â
Yuri Lopukhov
I don't think there is a way to avoid that, you need to either make a history call, or have all symbols you might need in the universe in order to recieve OHLC updates, which is probably much worse.Â
Perhaps you just need to add some more filters, e.g. in coarse selection choose top-1000 by dollar volume and only request history on those, not entire universe. And make sure you make one History call for all symbols you need, not one for every symbol, because that would work terribly slow.
Chetan Prabhu
Thanks Yuri. I was actually wondering about how expensive History calls are. Is one History call with 1000 symbols less expensive than 1000 individual calls? Even though they pull back the same amount of data, I’m guessing yes?
I will also try the approach of pre-filtering as much as possible before pulling in ATR.
Finally, can anyone from Quantconnect comment on when full OHLC data might become available in CoarseFilterSelection objects?
Thanks,
Chetan
Yuri Lopukhov
Â
yes, it can be much less efficient, I would guess because each request runs separately to a database, probably on another server, and this duplicates the extra network costs associated with each requests.
I would upvote adding OHLC to coarse selection, it is a pretty common need to know the price range from yesterday, and I don't think it is a lot of extra data to store.
Derek Melchin
Hi Chetan and Yuri,Â
To track our progress of adding OHLC to Coarse Fundamental, subscribe to the following GitHub Issue:
Best,
Derek Melchin
Want to invest in QuantConnect as we build the Linux of quant finance? Checkout our Wefunder campaign to join the revolution.
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Chetan Prabhu
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!