Hello,
I read that ticks are reported in intervals of seconds for equities. I am wondering how can I return the tick count of a security at a historical point of time. Say for instance the 1st second of a trading day in the past?
Thanks!
QUANTCONNECT COMMUNITY
Hello,
I read that ticks are reported in intervals of seconds for equities. I am wondering how can I return the tick count of a security at a historical point of time. Say for instance the 1st second of a trading day in the past?
Thanks!
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.
Fred Painchaud
Hi Keith,
This is not trivial. You need to use History(), ref :
However, History works from a moment in the past up until “now” (the current time of the algo). It returns data as specified within that period of time, specified in timedelta or bars. As tick data is huge, you will need to make your request and do your count close to the second in question… or you will request a lot of data, which will take a lot of time, only to count the number of tick in some second.
Here is some example to illustrate a bit:
I'm not counting, only printing here.
Moreover, History and Tick data is currently broken in Python. Ref :
Fred
Keith G
Thank you Fred! And thank you for the heads up that it is currently broken in Python. Do you know of an example floating around in C?
Fred Painchaud
Sure. The Python side of LEAN is actually some sort of wrapper around C# code. So examples in Python translate to C# very closely. So if you check out this:
and click on C# besides “Select language” on the first example, you'll get C# code everywhere, including at the beginning.
Re an exact example that counts the number of ticks for an equity during the first second after market open, I don't think one is floating around unfortunately.
Cheers,
Fred
Keith G
Thanks again Fred!
Keith G
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!