Hi, I'm importing custom price time series data, for stocks on Taiwan stock exchange. I want to set the market open and market close times (M-F, 0900-1330) using SecurityExchangeHours:
class Algorithm(QCAlgorithm):
def Initialize(self):
market_hours = {
DayOfWeek.Monday: LocalMarketHours(DayOfWeek.Monday, [
MarketHoursSegment(MarketHoursState.MARKET, timedelta(hours=9), timedelta(hours=13, minutes=30))
]), # Same for Tue, Wed, etc
}
exchange_hours = SecurityExchangeHours(
time_zone=TimeZones.HongKong, # This is same time zone as TW
holidays=[], # List of holidays
market_hours_for_each_day_of_week=market_hours,
early_closes={}, # Dictionary of early close dates and times
late_opens={} # Dictionary of late open dates and times
)
self.set_market_hours("1101.TW", exchange_hours)
However, I keep getting this error:
During the algorithm initialization, the following exception has occurred: Trying to dynamically access a method that does not exist throws a TypeError exception. To prevent the exception, ensure each parameter type matches those required by the () method. Please checkout the API documentation.
at Initialize
exchange_hours = SecurityExchangeHours(
^^^^^^^^^^^^^^^^^^^^^^
in main.py: line 39
No method matches given arguments for .ctor: () (Open Stack Trace)
I'm confused since it looks like I'm already passing parameters to SecurityExchangeHours constructor. Any help? Thanks!
Kinton
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!