Back

Security.Exchange.ExchangeOpen never false in Tick resolution.

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.

Update Backtest








Try this IsMarketOpen(iSymbol)

0

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);
}
}
}
}
0

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.


Hi, simply set extendedMarketHours: false.

In second resolution Quit method will be called one time.

Not in Tick resolution.

0

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.
 

1

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.


Update Backtest





0

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.


Loading...

This discussion is closed