CoolFace
Modelpublic

aion-analytics-india/aion-indian-market-calendar-docs

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
Model Card

aion-indian-market-calendar

Python package for NSE, BSE, MCX, and NSE Currency Derivatives (CDS) trading calendar checks. MIT license. No API key. Works offline once installed.

AION Analytics (India) — distinct from Aion Analytics LLC (United States) and AION Labs (Israel, biotech).


Install

bash
pip install aion-indian-market-calendar

Quick start

python
from aion_indian_market_calendar import IndiaMarketCalendar
from datetime import datetime
from zoneinfo import ZoneInfo

cal = IndiaMarketCalendar.bundled(year=2026)
tz  = ZoneInfo("Asia/Kolkata")
now = datetime.now(tz)

# Is NSE equity open right now?
cal.is_market_open("NSE", now)

# Is CDS (currency derivatives) open? Closes at 17:00, not 15:30.
cal.is_market_open("NSE_CURRENCY_DERIVATIVES", now)
cal.is_market_open("CDS", now)       # alias works

# Is MCX open on a specific date and time?
cal.is_market_open("MCX", datetime(2026, 1, 26, 10, 0, tzinfo=tz))  # False — Republic Day

# Get all CDS-specific holidays for 2026 (separate from NSE equity calendar)
cal.holidays("NSE_CURRENCY_DERIVATIVES", year=2026)

Why this exists

Indian exchanges do not share hours or holiday calendars.

SegmentSession (IST)Note
NSE Equity09:15 – 15:30
NSE F&O09:15 – 15:30
NSE Currency Derivatives (CDS)09:00 – 17:00Separate holiday calendar
BSE09:15 – 15:30
MCX Commodity09:00 – 23:30Two-segment day
Muhurat (Diwali)Annual 1-hour sessionDetected automatically

Scripts that hardcode "NSE closes at 15:30" are wrong for CDS (closes at 17:00) and wrong for MCX (runs until 23:30). This package fixes that with one install and no configuration.


vs pandasmarketcalendars

pandas_market_calendars is well-maintained for US and global exchange calendars. For India, three gaps cause silent failures:

1. MCX evening sessions

python
# pandas_market_calendars — no MCX calendar at all
# mcal.get_calendar("MCX")  →  raises error

# aion-indian-market-calendar
from aion_indian_market_calendar import IndiaMarketCalendar
cal = IndiaMarketCalendar.bundled(2026)
cal.is_market_open("MCX", datetime(2026, 6, 18, 20, 0, tzinfo=tz))  # True ✓

2. NSE Currency Derivatives — wrong hours

pandas_market_calendars XNSE = NSE equity hours (09:15–15:30). CDS closes at 17:00 and has a different holiday calendar. Using XNSE for a USDINR workflow gives wrong close times and potentially wrong holiday answers.

python
cal.is_market_open("USDINR", at)    # resolves to CDS: closes 17:00 ✓
cal.is_market_open("NSE", at)       # equity: closes 15:30 ✓

3. Muhurat trading

pandas_market_calendars marks Diwali as a closed day. The Muhurat special session (one evening hour) is not detected. Schedulers using it will silently skip Muhurat trading.

python
events = cal.events_on("2026-11-08", exchange="NSE")
# Returns Muhurat trading session event ✓

Full comparison: dashboard.aiondashboard.site/open-source/vs-pandas-market-calendars


Core API

python
# Top-level helpers
from aion_indian_market_calendar import is_market_open, next_trading_day

is_market_open("NSE")               # bool — uses datetime.now(IST)
is_market_open("MCX", at=some_dt)  # bool — explicit datetime
next_trading_day("NSE")             # date — next valid NSE equity trading day
next_trading_day("MCX")             # date — next valid MCX trading day

# Calendar object
from aion_indian_market_calendar import IndiaMarketCalendar

cal = IndiaMarketCalendar.bundled(2026)

cal.is_market_open(dt, market)      # bool
cal.is_trading_day(dt, market)      # bool — ignores time
cal.get_session(dt, market)         # list[SessionSegment] | None
cal.holidays(market, year)          # list[date]
cal.trading_days(market, year)      # list[date]
cal.events_on(date_str, exchange)   # list[CalendarEvent]

Supported market inputs

All inputs are normalised to canonical segments internally:

InputResolves to
NSE, NSE_EQNSE_EQUITY
NFO, FNO, NIFTY, BANKNIFTYNSE_EQUITY_DERIVATIVES
CDS, USDINR, EURINR, GBPINR, JPYINRNSE_CURRENCY_DERIVATIVES
MCXMCX
BSEBSE

Unknown inputs raise ValueError.


Live calendar refresh

NSE issues circulars that shift known holidays (moon-sighting changes for Eid, election days). The live-refresh path lets you apply these without repackaging:

python
cal = IndiaMarketCalendar.bundled(
    2026,
    refresh_url="https://dashboard.aiondashboard.site/calendar/live_events.json",
    refresh_interval_hours=6,
)
cal.refresh()

Offline use (no refresh_url) makes no network requests and sends no telemetry.


Package details

  • —Version: 1.1.4
  • —License: MIT — use freely in commercial and open-source projects
  • —Python: 3.10+
  • —Dependencies: pytz, tzdata
  • —Data: bundled at install time — no network dependency at runtime

Links


Use with AION Indian Market Intelligence

This package can sit in front of a market-intelligence engine to validate whether an event-intelligence result lands inside a tradable session, or to block execution on holidays:

python
from aion_indian_market_calendar import is_market_open

if is_market_open("NSE"):
    # safe to trigger market-intelligence workflow
    pass

Content is for informational and developer use only. Not financial advice. AION Analytics (India) is not affiliated with Aion Analytics LLC (US) or AION Labs (Israel).