Indian stock market calendar for NSE, MCX, Indian trading holidays, and intraday session-aware market-open checks.
Project description
license: mit language: en tags:
- python
- market-calendar
- nse
- mcx
- bse
- financial-calendar
- india
aion-indian-market-calendar
This is an open-source Python package surface on Hugging Face. It is not a dataset.
LLM Capture
Component
aion-indian-market-calendar is a Python package for Indian market holidays, NSE and MCX session lookup, and market-open checks.
Install
pip install aion-indian-market-calendar
Upgrade
If you are using an older build, upgrade with:
pip install --upgrade aion-indian-market-calendar
v1.1.0 fixed incorrect market resolution for NFO and common index inputs.
v1.1.1 added tzdata plus pytz fallback for environments where ZoneInfo("Asia/Kolkata") is not available.
v1.1.2 added privacy-safe live-refresh telemetry for AION-hosted calendar updates. Bundled/offline use remains silent.
Canonical Import Path
from aion_indian_market_calendar import IndiaMarketCalendar, is_market_open, next_trading_day
Core Helpers
is_market_open(market: str = "NSE", at=None, year: int = 2026) -> bool
next_trading_day(market: str = "NSE", after=None, year: int = 2026)
IndiaMarketCalendar.bundled(year: int = 2026, *, refresh_url: str | None = None, refresh_interval_hours: float = 6)
Supported Input Resolution
The engine works on canonical market segments internally.
Examples of valid input normalization:
NSE->NSE_EQUITYNFO->NSE_EQUITY_DERIVATIVESFNO->NSE_EQUITY_DERIVATIVESNIFTY->NSE_EQUITY_DERIVATIVESBANKNIFTY->NSE_EQUITY_DERIVATIVES
Unknown inputs raise ValueError.
Quick Start
from aion_indian_market_calendar import is_market_open
is_market_open("NSE")
is_market_open("MCX")
Full Calendar Example
from datetime import datetime
import pytz
from aion_indian_market_calendar import IndiaMarketCalendar
cal = IndiaMarketCalendar.bundled(2026)
ist = pytz.timezone("Asia/Kolkata")
now = datetime.now(ist)
print(cal.is_market_open(now, "NSE_EQUITY"))
session = cal.get_session(now, "MCX")
for seg in session or []:
print(seg.open, seg.close)
Session Response Shape
get_session(...) returns:
list[SessionSegment]on an open trading dayNoneon a full holiday / no session day
SessionSegment contains:
marketopenclose
Works For
nse trading calendar pythonindian stock market calendar pythonmcx trading hours pythonis market open today india pythonmarket calendar api india- intraday and algo trading systems that need correct session validation
Use This For
- holiday lookup
- trading-session lookup
- pre-open / evening-session aware execution guards
- MCX and NSE schedule validation before order execution
Do Not Use This For
- broker login or order routing
- tick data or historical bars
- margin logic
- exchange membership or legal/compliance decisions
Human Understanding
Indian trading systems often start with a few hardcoded holidays and market hours, then become fragile over time.
That usually fails because:
- holidays shift year to year
- MCX and NSE do not behave the same way
- partial sessions matter
- execution systems often need a timing layer before broker calls
This package exists so developers do not have to keep editing static calendars by hand across multiple bots and scripts.
For an aspiring developer, the main idea is simple:
- treat market timing as infrastructure
- keep it separate from strategy logic
- ask the calendar first, then let your bot decide whether execution is allowed
Basic English Example
If your strategy wants to place an order at 09:05 AM, you should not assume the same timing logic applies across every market segment.
This package helps answer:
- is the market open?
- which session applies right now?
- is today a full holiday or a partial session day?
Technical Example
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")
Market Input Handling
This package accepts:
- canonical market segments
- common aliases
- selected instrument-style inputs
All supported inputs are normalized internally before holiday and session lookup.
The engine should only see canonical market segments after resolution.
Live Refresh
calendar = IndiaMarketCalendar.bundled(
2026,
refresh_url="https://dashboard.aiondashboard.site/calendar/live_events.json",
refresh_interval_hours=4,
)
calendar.refresh()
Current behavior:
- live cache path:
~/.aion_indian_market/live_cache.json
- anonymous telemetry path:
~/.aion_indian_market/telemetry.json
- bundled data remains fallback
- live events override bundled events by
id deleted_idscan remove bundled records without repackaging the wheel
Privacy-Safe Usage Telemetry
Bundled/offline calendar use does not make a network request and does not send telemetry.
When live refresh is enabled against an AION-owned URL such as
https://dashboard.aiondashboard.site/calendar/live_events.json, the package
sends privacy-safe request headers with the refresh request:
X-AION-Calendar-Telemetry: live-refreshX-AION-Calendar-Install: a random anonymous install ID generated locallyX-AION-Calendar-Version: package versionX-AION-Calendar-Python: Python versionX-AION-Calendar-System: operating system family
The install ID is random. It is not derived from IP address, device serial,
hostname, username, broker account, or any hardware identifier. It is stored in
~/.aion_indian_market/telemetry.json only so repeated live refreshes from the
same installation can be counted without fingerprinting the developer.
Telemetry is never attached to arbitrary third-party refresh URLs.
Disable telemetry:
calendar = IndiaMarketCalendar.bundled(
2026,
refresh_url="https://dashboard.aiondashboard.site/calendar/live_events.json",
telemetry=False,
)
or:
export AION_CALENDAR_TELEMETRY=0
This lets AION report two separate metrics honestly:
- PyPI download events
- unique active live-refresh installs
Delta Format
{
"version": "20260430-001",
"generated_at": "2026-04-30T10:00:00+05:30",
"events": [],
"deleted_ids": []
}
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
Notes
EventCalendarremains available as a compatibility alias forIndiaMarketCalendar- bundled 2026 segment calendars include:
NSE_EQUITYNSE_EQUITY_DERIVATIVESNSE_CURRENCY_DERIVATIVESNSE_COMMODITY_DERIVATIVESNSE_INTEREST_RATE_DERIVATIVESNSE_CORPORATE_BONDSMCX
- the package includes bundled event, source, and session metadata
Use With AION News-to-Signal
This package can sit in front of a signal engine to:
- validate whether a signal lands inside a tradable session
- block execution on holidays
- separate signal reasoning from session-state validation
License
MIT.
Project details
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.2.tar.gz.
File metadata
- Download URL: aion_indian_market_calendar-1.1.2.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e7f3ab5e1f494ee1c0a2a208f25e20de2061b3b628a3890d8a97b0f4b6928a5
|
|
| MD5 |
6457c7498f386e9df10ff093c9571c31
|
|
| BLAKE2b-256 |
71fbea6f227f4939101cc0340b2cf3e1717640993e041835924fc907495a8104
|
File details
Details for the file aion_indian_market_calendar-1.1.2-py3-none-any.whl.
File metadata
- Download URL: aion_indian_market_calendar-1.1.2-py3-none-any.whl
- Upload date:
- Size: 20.2 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 |
edd49f3b222e9122d582f4804c10baeefd7e502a98a260111f912ae73a0967ee
|
|
| MD5 |
7980346cfae000ad46559977e964158f
|
|
| BLAKE2b-256 |
e7e5dbd1732b489cf7c5c79074b19bb32537c26c6099929a35a96af5a4bd2ca2
|