Hi,
I have found many posts discussing how to capture the opening price for a stock at daily or minute resolution (using scheduled events, or Open of daily bar) but didn't really find anything when dealing with tick data.
The way I am doing it right now is by using the following:
if (tick.Time.TimeOfDay < new TimeSpan(9, 30, 00) || new TimeSpan(16, 00, 00) <= tick.Time.TimeOfDay)
{
if (tick.TickType != TickType.Trade)
{
dayOpen = tick.Price;
}
}
But I find that in some instances I capture different prices (I am running LEAN on 2 Interactive Brokers account: paper and live).
Which brings me to the following question, which time is LEAN/QC using? Is it using the datafeed's time or the computer's time?
I am going to run a 2nd paper instance on a QC server using the standard datafeed. In this instance, which time is QC using? And if using the computer's time, how are the clocks synchronised?
Louis Szeto
Hi Georgea,
We have implemented the logic you are looking for on the default modeling of market-on-open fills for equity: EquityFillModel.cs#L497:L507
In this case, we are getting the Tick data stored in the Security object:
If your algorithm is getting the Tick data from the Slice object, it should use:
instead.
Best regards,
Louis
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.
Georgea Trading
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!