Skip to main content

indian-market-data

NSE India      MCX India

Download NSE and MCX India market data as pandas DataFrames.
Bhavcopy · Nifty indices · F&O · Commodity spot prices · Works on AWS Lambda

PyPI Python License: MIT

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 View Documentation →


Polars output (optional)

By default every function returns a pandas DataFrame. To get polars DataFrames instead, install the extra and set one environment variable before importing — no code changes needed, and it applies to NSE, BSE and MCX alike:

pip install indian-market-data[polars]
import os
os.environ["IMD_DATAFRAME"] = "polars"   # set before importing

from indianmarketdata import nse, bse, mcx
type(nse.get("capital_market", "equities_sme", "sec_bhavdata_full", "2026-05-22"))  # polars.DataFrame
type(bse.get_index("SENSEX", "2026-01-01", "2026-05-22"))                            # polars.DataFrame
type(mcx.get_spot_recent())                                                          # polars.DataFrame

All internal logic stays in pandas; conversion happens only at the final return step. Leave IMD_DATAFRAME unset (or =pandas) for the default pandas output.


License

MIT — data sourced from NSE India and MCX India.

Metadata

Release files for indian-market-data 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for indian-market-data 1.1.1
File Size Uploaded Provenance Actions
indian_market_data-1.1.1.tar.gz 5.3 kB With provenance Details for indian_market_data-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for indian-market-data 1.1.1
File Interpreter ABI Platform Actions
indian_market_data-1.1.1-py3-none-any.whl Python 3 none any Details for indian_market_data-1.1.1-py3-none-any.whl

Total release size: 10.1 kB

Release files / indian_market_data-1.1.1.tar.gz

Download URL indian_market_data-1.1.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fa1c058cb6a340c4f3c616dc19bc722f0db9a29ae1fa11f4fb32f1af4bab86d6
BLAKE2b-256 checksum
How to use checksums
5f3afde82b2796fd0514443da232569446d6e2d57198aa5509d25cf2d4b366bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

Release files / indian_market_data-1.1.1-py3-none-any.whl

Download URL indian_market_data-1.1.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f80726d78e5cf40b49ad41e10865b2112f7da1198e3fbd88506421888abf498
BLAKE2b-256 checksum
How to use checksums
98a47db9a8175d0150b07de0a8347f64306259b07a1e020edba7c46ad22905c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

Security for indian-market-data 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for indian_market_data-1.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page