calendar
calendar
Exchange sessions, closures, and market-time operations.
Functions
| non_trading_days_after |
Count closed calendar dates after each exchange session. |
| schedule |
Return exchange sessions and their local opening and closing times. |
non_trading_days_after
calendar.non_trading_days_after(dates, exchange)
Count closed calendar dates after each exchange session.
An early close is still a trading session. For example, a Friday early close followed by a Monday session has two non-trading days after it.
Parameters
| dates |
pd.Series |
Session dates. Time components are ignored and the index is preserved. |
required |
| exchange |
str |
ISO 10383 market identifier code, such as "XNYS" or "XSTO". |
required |
Returns
|
pd.Series |
Integer Series named non_trading_days_after. |
Raises
|
TypeError |
If dates is not a Series. |
|
ValueError |
If the exchange is unknown or a value is missing or is not an exchange session. |
schedule
calendar.schedule(start, end, exchange)
Return exchange sessions and their local opening and closing times.
Parameters
| start |
str | pd.Timestamp |
First calendar date to include. |
required |
| end |
str | pd.Timestamp |
Last calendar date to include. |
required |
| exchange |
str |
ISO 10383 market identifier code, such as "XNYS" or "XSTO". |
required |
Returns
|
pd.DataFrame |
DataFrame indexed by session date with timezone-aware open and |
|
pd.DataFrame |
close columns expressed in the exchange’s local timezone. |
Raises
|
ValueError |
If the exchange is unknown, a date is missing, or start is after end. |
Back to top