I used to get close price when Security.Exchange.ExchangeOpen was false in Second resolution.
But in Tick resolution, it's never set to false.
PS : I cannot use scheduled events, I need the SetWarmup method.
QUANTCONNECT COMMUNITY
I used to get close price when Security.Exchange.ExchangeOpen was false in Second resolution.
But in Tick resolution, it's never set to false.
PS : I cannot use scheduled events, I need the SetWarmup method.
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.
Artemiusgreat
Try this IsMarketOpen(iSymbol)
Alexandre Catarino
I couldn't reproduce the issue. Here is my attempt:
namespace QuantConnect { public class BasicTemplateAlgorithm : QCAlgorithm { private Equity _spy; public override void Initialize() { SetStartDate(2013, 10, 07); SetEndDate(2013, 10, 08); _spy = AddEquity("SPY", Resolution.Tick, extendedMarketHours: true); } public override void OnData(Slice data) { if (!Portfolio.Invested) { SetHoldings(_spy.Symbol, 1); Debug("Purchased Stock"); } if (!_spy.Exchange.ExchangeOpen) { Quit("Market is closed: " + Time); } } } }
Maly Lemire
Hi, simply set extendedMarketHours: false.
In second resolution Quit method will be called one time.
Not in Tick resolution.
Alexandre Catarino
Roughly speaking, the algorithm Time used to evaluate whether the market is open or closed is set to be the data EndTime. If we are working with second-resolution data, when Time is 4 pm, OnData receives a bar that was formed from 3:59:59 to 4:00:00 pm. In this case, the market is closed.
On the other hand, when we are working with tick data, Time will never be 4 pm, because extendedMarketHours is false. In fact, since our tick data is time-stamped to the second, when Time is 3:59:59 pm, the ticks belong to the 3:59:59 to 4:00:00 pm interval, but their EndTime is 3:59:59 pm, because tick data does not have a period (an open and a close).
This is not a bug. It is a feature related to the data resolution.
Maly Lemire
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!