Trading and Orders
Trading Calendar
Get a Single Trading Day
To get the trading events of the current day, call the GetTradingDay
get_trading_day
method with no arguments.
var tradingDay = TradingCalendar.GetTradingDay();
trading_day = self.trading_calendar.get_trading_day()
To get the trading events of a specific day, pass a DateTime
datetime
object to the GetTradingDay
get_trading_day
method.
var tradingDay = TradingCalendar.GetTradingDay(new DateTime(2022, 6, 1));
trading_day = self.trading_calendar.get_trading_day(datetime(2022, 6, 1))
Get Trading Days
To get all the trading events across a range of dates, pass start and end DateTime
datetime
objects to the GetTradingDays
get_trading_days
method.
var startDate = new DateTime(2022, 6, 1); var endDate = new DateTime(2022, 7, 1); var tradingDays = TradingCalendar.GetTradingDays(startDate, endDate);
start_date = datetime(2022, 6, 1) end_date = datetime(2022, 7, 1) trading_days = self.trading_calendar.get_trading_days(start_date, end_date)
To get specific trading events across a range of dates, pass a TradingDayType
enumeration member and the dates to the GetDaysByType
get_days_by_type
method.
var tradingDays = TradingCalendar.GetDaysByType(TradingDayType.OptionExpiration, startDate, endDate);
trading_days = self.TradingCalendar.get_days_by_type(TradingDayType.OPTION_EXPIRATION, start_date, end_date)
The TradingDayType
enumeration has the following members: