TradingCalendar
QuantConnect.TradingCalendar
TradingCalendar(
security_manager: SecurityManager,
market_hours_database: MarketHoursDatabase,
)
Bases: Object
Class represents trading calendar, populated with variety of events relevant to currently trading instruments
Initialize a new TradingCalendar instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
security_manager
|
SecurityManager
|
SecurityManager for this calendar |
required |
market_hours_database
|
MarketHoursDatabase
|
MarketHoursDatabase for this calendar |
required |
get_trading_day
get_trading_day() -> TradingDay
get_trading_day(day: Union[datetime, date]) -> TradingDay
Signature descriptions:
-
Method returns TradingDay that contains trading events associated with today's date
-
Method returns TradingDay that contains trading events associated with the given date
Returns:
| Type | Description |
|---|---|
TradingDay
|
Populated instance of TradingDay. |
get_days_by_type
get_days_by_type(
type: TradingDayType,
start: Union[datetime, date],
end: Union[datetime, date],
) -> Iterable[TradingDay]
Method returns TradingDay of the specified type (TradingDayType) that contains trading events associated with the range of dates
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
TradingDayType
|
Type of the events |
required |
start
|
Union[datetime, date]
|
Start date of the range (inclusive) |
required |
end
|
Union[datetime, date]
|
End date of the range (inclusive) |
required |
Returns:
| Type | Description |
|---|---|
Iterable[TradingDay]
|
|
get_trading_days
get_trading_days(
start: Union[datetime, date], end: Union[datetime, date]
) -> Iterable[TradingDay]
Method returns TradingDay that contains trading events associated with the range of dates
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
Union[datetime, date]
|
Start date of the range (inclusive) |
required |
end
|
Union[datetime, date]
|
End date of the range (inclusive) |
required |
Returns:
| Type | Description |
|---|---|
Iterable[TradingDay]
|
|