Indian stock market calendar for NSE, MCX, Indian trading holidays, and intraday session-aware market-open checks.
Project description
aion-indian-market-calendar
Indian stock market calendar for Python — NSE trading calendar, MCX trading hours, and Indian market holidays API.
⚠️ Update (v1.1.0):
Market resolution has been fixed to ensure all inputs map to canonical segments.
"NFO"now correctly resolves to"NSE_EQUITY_DERIVATIVES""NIFTY"/"BANKNIFTY"resolve to derivatives by default
If you previously passed non-canonical market names, behavior is now deterministic.
If you are using <=1.0.0, upgrade immediately:
pip install --upgrade aion-indian-market-calendar
v1.1.0 fixes incorrect market resolution for NFO and index inputs.
Use this if you need to answer:
- is NSE market open today?
- what are NSE/MCX trading hours right now?
- which days are trading holidays in India?
- build intraday or algo trading systems with correct market timings
Works as a Python API for NSE trading calendar, Indian stock market holidays, MCX trading hours, "is market open today India" queries, and financial market calendar needs in quantitative finance and algorithmic trading.
Includes macro-event awareness (RBI, Budget, FOMC) for trading system restrictions.
If you tried using pandas_market_calendars for India and ran into incorrect holidays or missing MCX sessions, this package fixes those gaps.
Structure
aion_indian_market_calendar/
├── __init__.py
├── _calendar.py
├── models.py
├── data/
│ └── events_2026.json
├── tests/
│ ├── conftest.py
│ └── test_calendar.py
├── pyproject.toml
└── README.md
Quick Start
Simple Python API, no external services required.
Is the market open right now?
from aion_indian_market_calendar import is_market_open
is_market_open("NSE") # True / False
is_market_open("MCX") # Handles evening sessions correctly
Used in intraday trading and algo trading systems to prevent execution during closed sessions. Works for real-time checks like: "is NSE market open today?"
Next trading day
from aion_indian_market_calendar import next_trading_day
next_trading_day("NSE")
Full calendar API
import pytz
from datetime import datetime
from aion_indian_market_calendar import IndiaMarketCalendar
cal = IndiaMarketCalendar.bundled(2026)
ist = pytz.timezone("Asia/Kolkata")
now = datetime.now(ist)
# Check if NSE equity is trading right now
print("NSE open?", cal.is_market_open(now, "NSE_EQUITY"))
# Get today's exact trading session (accounts for partial MCX days)
session = cal.get_session(now, "MCX")
for seg in session or []:
print(f"MCX: {seg.open} - {seg.close}")
# List all NSE equity holidays for 2026
for d in cal.holidays("NSE_EQUITY", 2026):
print(d)
Designed for trading systems, bots, and execution engines that require accurate Indian market timings.
Market Input Handling
This package accepts:
- canonical market segments (recommended)
- common aliases such as
NFO - common instruments such as
NIFTYandBANKNIFTY
All supported inputs are normalized internally to canonical market segments before holiday and session lookup.
Examples:
from datetime import datetime
from aion_indian_market_calendar import IndiaMarketCalendar
cal = IndiaMarketCalendar.bundled(2026)
probe = datetime.fromisoformat("2026-01-27T10:00:00+05:30")
assert cal.get_session(probe, market="NFO") == cal.get_session(probe, market="NSE_EQUITY_DERIVATIVES")
assert cal.get_session(probe, market="NIFTY") == cal.get_session(probe, market="NSE_EQUITY_DERIVATIVES")
Unknown market inputs now raise ValueError.
Use with AION News-to-Signal
Used alongside AION News-to-Signal for:
- validating whether a signal falls within trading hours
- blocking trades on holidays or macro-event windows
- aligning intraday execution with real Indian market sessions
Why Developers Choose aion-indian-market-calendar
- Save weeks of engineering: no need to scrape NSE circulars, parse Hindu calendars, or model MCX partial sessions
- Production-ready: verified against official exchange calendars and tested for known edge cases
- Live delta updates: refresh from a remote URL, no
pip install --upgradeneeded for every holiday change - LLM-friendly: static JSON and live endpoint are machine-readable, so coding assistants can query or embed the package
Live Refresh
calendar = IndiaMarketCalendar.bundled(
2026,
refresh_url="https://<username>.github.io/<repo>/live_events.json",
refresh_interval_hours=4,
)
calendar.refresh()
- live deltas are cached at
~/.aion_indian_market/live_cache.json - bundled static events remain the fallback
- live events override bundled events by
id deleted_idscan remove bundled events without repackaging the wheel
Delta Format
{
"version": "20260430-001",
"generated_at": "2026-04-30T10:00:00+05:30",
"events": [],
"deleted_ids": []
}
Notes
data/events_2026.jsoncan be either:- a plain list of event objects, or
- an object with top-level metadata plus an
eventslist
- main typed models:
MarketEventEventPolicySessionSegment
- bundled metadata also exposes:
calendar.sourcescalendar.market_timingscalendar.default_sessions
- convenience helpers:
is_market_open(market="NSE", at=None, year=2026)next_trading_day(market="NSE", after=None, year=2026)
- live refresh metadata exposes:
calendar.refresh_urlcalendar.refresh_interval
- bundled 2026 segment calendars now include:
NSE_EQUITYNSE_EQUITY_DERIVATIVESNSE_CURRENCY_DERIVATIVESNSE_COMMODITY_DERIVATIVESNSE_INTEREST_RATE_DERIVATIVESNSE_CORPORATE_BONDSMCX
EventCalendarremains available as a compatibility alias forIndiaMarketCalendar- the current bundled data is copied from:
src/shared_core/risk/special_events_and_holidays.jsonand extended with:https://nsearchives.nseindia.com/content/RSS/Circulars.xmlhttps://www.nseindia.com/resources/exchange-communication-holidayshttps://www.mcxindia.com/market-operations/trading-survelliance/trading-holidays
- repo-side helpers for live updates:
scripts/poll_nse_rss.py.github/workflows/update_live_events.yml.github/workflows/publish_live_events.yml
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aion_indian_market_calendar-1.1.0.tar.gz.
File metadata
- Download URL: aion_indian_market_calendar-1.1.0.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f5672a2af57605f4028e26ab4cd5fc110c9e7b7d2b6335812413ebd92ba952f
|
|
| MD5 |
f4e779991f75c77756c4368dc7ac2408
|
|
| BLAKE2b-256 |
6eb73d478752e0ec5a375edf901aa52784c22d6d0ca808a273723e5b375702de
|
File details
Details for the file aion_indian_market_calendar-1.1.0-py3-none-any.whl.
File metadata
- Download URL: aion_indian_market_calendar-1.1.0-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcf1ca112615dc575f4e321e12ca0d11539c6b5429e05a63fd7977e6f295c50c
|
|
| MD5 |
b1087659e9635aa03f72996b1c1e4c0e
|
|
| BLAKE2b-256 |
a52b0eb59a2c6ea0e835c2b499f3fae0208ceb7616fe4a6cfbd9147430af1760
|