I would like to use custom data in live trading mode. I have asked question related to this one few weeks ago (
https://www.quantconnect.com/forum/discussion/11220/live-trading-with-custom-data/p1), but I am not sure how to approach the problem when custom data feed have delays.
Let’s say I use hour resolution in my Algo, where algo trades only one asset. The custom data is csv file that is updated every hour. But the problem is that custom data is not available on exact hour bases (say 10:00, 11:00), but with small delay (10:01 11:01). How should I organize my code to retrieve my data as soon as it is available?
I see only 2 solutions:
1) Use lower resolution and ask for data, say every minute. The downside is that I make algo much slower because it uses much higher resolution even if custom data is on hour frequencies (with delays).
2) Use some kind of loop and check if new data is available, but I am not sure if this is possible in OnData method?
What should be recommended way in QC/Lean and how to approach this problem?
Derek Melchin
Hi Mislav,
Since the live data points are slightly delayed, we recommend setting the resolution of the custom data to minute. We can then make our trading decisions only when the custom data points are passed to the OnData method by using
if data.ContainsKey(<customDataSymbol>): # place trades
Best,
Derek Melchin
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.
Mislav Sagovac
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!