trading_agent.scheduling.market_status
¶
Describes the market's state in one line, for the context line at the top of every message to a desk.
Desks know the time from that line but not the exchange calendar, so without this a desk planned "Tuesday" when Tuesday was a holiday. The line says whether NSE equities trade today, whether they are open now, the next trading day, and any weekday holiday in the coming week.
Typical usage example:
text = MarketStatus(calendar, hours).describe(now) # 'NSE closed today (weekend); next trading day Mon 19 Oct; holiday ahead: Tue 20 Oct Dussehra'
MarketStatus
¶
Writes the market line.
Creates the describer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar
|
MarketCalendar
|
The exchange calendar. |
required |
hours
|
ExchangeHours
|
The trading sessions. |
required |
Source code in src/trading_agent/scheduling/market_status.py
describe
¶
The market's state at a moment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
moment
|
datetime
|
The moment. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Today's state for NSE equities, the next trading day, and holidays in the coming week. |