NSE + MCX India market data as pandas DataFrames — bhavcopy, Nifty indices, F&O, commodity spot prices. AWS Lambda ready.
Project description
indian-market-data
Download NSE and MCX India market data as pandas DataFrames — bhavcopy, Nifty indices, F&O, commodity spot prices. Works on AWS Lambda, Snowflake, and any cloud environment.
pip install indian-market-data
What's included
| Package | Datasets | Exchange | Description |
|---|---|---|---|
nse-data |
91 | NSE India | Equities, F&O, debt, indices, EGR |
mcx-data |
2 | MCX India | Commodity spot prices (recent + archive) |
Install individually or together:
pip install nse-archives # NSE only
pip install mcx-data # MCX only
pip install indian-market-data # Both
NSE — Quick Start
from nsedata import nse
# or: from indianmarketdata import nse
# Daily prices
df = nse.get("capital_market", "equities_sme", "sec_bhavdata_full", "2026-05-22")
df = nse.get("capital_market", "indices", "ind_close_all", "2026-05-22")
# F&O
df = nse.get("derivatives", "equity", "fo_bhav_udiff", "2026-05-22")
df = nse.get("derivatives", "equity", "fo_secban", "2026-05-22")
# Debt
df = nse.get("debt", "corporate", "cbm_trd", "2026-05-22")
# Historical index + TRI (from niftyindices.com)
df = nse.get_historical_index("NIFTY 50", "01-Jan-2026", "31-Mar-2026")
df = nse.get_tri("NIFTY 50", "01-Jan-2026", "31-Mar-2026")
# Download to S3
nse.download("capital_market", "equities_sme", "sec_bhavdata_full", "2026-05-22",
s3_bucket="my-bucket", s3_prefix="raw/nse/")
# 91 datasets across equities, F&O, debt, indices, EGR
nse.list_datasets()
86 datasets confirmed working on AWS Lambda (May 2026). Covers:
- Capital Market: Equities & SME (32), Indices (2), Mutual Fund (1), SLB (12)
- Derivatives: Equity F&O (8), Commodity (3), Currency (3), Interest Rate (9)
- Debt: Corporate (15), Debt Segment (4), Tri-Party Repo (1)
- EGR (1)
MCX — Quick Start
from mcxdata import mcx
# or: from indianmarketdata import mcx
# Today's spot prices — all 28 commodities
df = mcx.get_spot_recent()
# → Commodity, Unit, Location, Spot Price (Rs.), Up/Down, Date
# Single commodity
df = mcx.get_spot_recent(commodity="GOLD")
# Historical (requires specific commodity — ALL not supported by MCX)
df = mcx.get_spot_archive("2026-05-01", "2026-05-22", commodity="GOLD")
df = mcx.get_spot_archive("2026-05-01", "2026-05-22", commodity="SILVER")
df = mcx.get_spot_archive("2026-05-01", "2026-05-22", commodity="CRUDEOIL")
# Download to S3
mcx.download("spot", "market", "spot_recent",
s3_bucket="my-bucket", s3_prefix="raw/mcx/")
# Available commodities (28 total)
mcx.list_commodities()
# → ['ALUMINI', 'ALUMINIUM', 'CARDAMOM', 'COPPER', 'COTTON', 'COTTONOIL',
# 'CPO', 'CRUDEOIL', 'CRUDEOILM', 'ELECDMBL', 'GOLD', 'GOLDGUINEA',
# 'GOLDM', 'GOLDPETAL', 'GOLDTEN', 'KAPAS', 'LEAD', 'LEADMINI',
# 'MENTHAOIL', 'NATGASMINI', 'NATURALGAS', 'NICKEL', 'SILVER', 'SILVERM',
# 'SILVERMIC', 'STEELREBAR', 'ZINC', 'ZINCMINI']
Combined Usage
from indianmarketdata import nse, mcx
date = "2026-05-22"
# NSE equity prices
nse_df = nse.get("capital_market", "equities_sme", "sec_bhavdata_full", date)
# MCX gold spot
mcx_df = mcx.get_spot_recent(commodity="GOLD")
print(f"NSE: {len(nse_df)} securities")
print(f"MCX Gold: ₹{mcx_df['Spot Price (Rs.)'].iloc[0]:,.2f}/10g")
AWS Lambda
Both packages are designed to work from Lambda:
# lambda_function.py
import json
from nsedata import nse
from mcxdata import mcx
def lambda_handler(event, context):
date = event["date"]
# NSE bhav
nse.download("capital_market", "equities_sme", "sec_bhavdata_full", date,
s3_bucket=event["bucket"], s3_prefix="nse/")
# MCX gold
mcx.download("spot", "market", "spot_archive",
from_date=date, to_date=date, commodity="GOLD",
s3_bucket=event["bucket"], s3_prefix="mcx/")
return {"statusCode": 200}
Build the layer:
cd .lambda_layer
./build.sh # nse-data + mcx-data + pandas + curl-cffi + openpyxl
CLI
# NSE
nse-data --help
nse-data list
# MCX
mcx-data --help
mcx-data spot-recent --commodity GOLD
mcx-data spot-archive --from 01/05/2026 --to 22/05/2026 --commodity GOLD
Documentation
Full docs at NikhilSuthar.github.io/indian-market-data
License
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 indian_market_data-1.0.0.tar.gz.
File metadata
- Download URL: indian_market_data-1.0.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fec1cb429955c1c7e41fac3554bf48b0935e68825294235a3e840154d3308739
|
|
| MD5 |
66b6be62e687bf7c3b87b941ba8016ea
|
|
| BLAKE2b-256 |
2e5491ede8dff20b3252a62f3d5733ce9309a3a1cc73f95a17a44935c6174e47
|
Provenance
The following attestation bundles were made for indian_market_data-1.0.0.tar.gz:
Publisher:
publish-umbrella.yml on NikhilSuthar/indian-market-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
indian_market_data-1.0.0.tar.gz -
Subject digest:
fec1cb429955c1c7e41fac3554bf48b0935e68825294235a3e840154d3308739 - Sigstore transparency entry: 1624479268
- Sigstore integration time:
-
Permalink:
NikhilSuthar/indian-market-data@3793a3ae802805f1e30016cfbcf995626aeab259 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/NikhilSuthar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-umbrella.yml@3793a3ae802805f1e30016cfbcf995626aeab259 -
Trigger Event:
push
-
Statement type:
File details
Details for the file indian_market_data-1.0.0-py3-none-any.whl.
File metadata
- Download URL: indian_market_data-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c40bb63cf96bc94595bde6a7c590fa1d59605a375baa9782bc9c9f3a4388105
|
|
| MD5 |
c305eedb02b5835e92b511ed64d5e59f
|
|
| BLAKE2b-256 |
88631b0c7dc577cded800e3a1bd850e7a8087f6fc678c9d534bf55e0cb5aba41
|
Provenance
The following attestation bundles were made for indian_market_data-1.0.0-py3-none-any.whl:
Publisher:
publish-umbrella.yml on NikhilSuthar/indian-market-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
indian_market_data-1.0.0-py3-none-any.whl -
Subject digest:
5c40bb63cf96bc94595bde6a7c590fa1d59605a375baa9782bc9c9f3a4388105 - Sigstore transparency entry: 1624479370
- Sigstore integration time:
-
Permalink:
NikhilSuthar/indian-market-data@3793a3ae802805f1e30016cfbcf995626aeab259 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/NikhilSuthar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-umbrella.yml@3793a3ae802805f1e30016cfbcf995626aeab259 -
Trigger Event:
push
-
Statement type: