Skip to main content

NSE + BSE + MCX India market data as pandas DataFrames — bhavcopy, SENSEX/Nifty indices, F&O, commodity spot prices. AWS Lambda ready.

Project description

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 →


License

MIT — data sourced from NSE India and MCX India.

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

indian_market_data-1.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

indian_market_data-1.0.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file indian_market_data-1.0.1.tar.gz.

File metadata

  • Download URL: indian_market_data-1.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for indian_market_data-1.0.1.tar.gz
Algorithm Hash digest
SHA256 11292a025b48f9fef238895ab572977a035e8e5316b2f64d539acbb30d1c7b07
MD5 37fd2d6117fb68b3cb5fe798df3ffeb4
BLAKE2b-256 f3bae234583a680fe8c0a01514163283fd9850acd8258d59d506af8d94ceafc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for indian_market_data-1.0.1.tar.gz:

Publisher: publish-umbrella.yml on NikhilSuthar/indian-market-data

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file indian_market_data-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for indian_market_data-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3c6072495155aeb3d249d086f48e365468849b7da49b3a4fc22f410df9cde7e4
MD5 4a4112ce00c522e716980cefc80fd253
BLAKE2b-256 f165230479abbbf626c9fac58ae39e9cc4fd6171dad8a08af0f9fa7c3bb20c03

See more details on using hashes here.

Provenance

The following attestation bundles were made for indian_market_data-1.0.1-py3-none-any.whl:

Publisher: publish-umbrella.yml on NikhilSuthar/indian-market-data

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page