Skip to main content

Download MCX India commodity market data as pandas DataFrames — spot prices (recent + archive), futures bhavcopy. Works on AWS Lambda.

Project description

mcx-data

MCX India

Download MCX India commodity spot market data as pandas DataFrames.
28 commodities — GOLD, SILVER, CRUDEOIL, NATURALGAS and more.
Works on AWS Lambda via Chrome TLS impersonation (bypasses Akamai WAF).

PyPI version Python 3.9+ License: MIT

Download MCX India commodity spot market data as pandas DataFrames. Works from AWS Lambda and any cloud environment.

Full Documentation → NikhilSuthar.github.io/indian-market-data/mcx-spot

Part of the indian-market-data monorepo — also see nse-archives.

pip install mcx-data

Quick Start

from mcxdata import mcx

# Today's spot prices — all 28 commodities
df = mcx.get_spot_recent()

# Single commodity
df = mcx.get_spot_recent(commodity="GOLD")

# Historical (requires specific commodity)
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")

# Download to S3
mcx.download("spot", "market", "spot_recent",
             s3_bucket="my-bucket", s3_prefix="raw/mcx/")

# Available commodities (28)
mcx.list_commodities()

Datasets

Dataset Description Date Param
spot_recent Today's spot prices — all 28 commodities None
spot_archive Historical spot prices by commodity + date range from_date, to_date

Available Commodities (28)

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

Notes

  • MCX archive requires a specific commodity"ALL" returns empty (MCX API limitation)
  • Uses curl-cffi Chrome TLS impersonation to bypass MCX Akamai WAF
  • Lambda IPs are generally unblocked — works reliably on AWS

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:

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

from mcxdata import mcx
df = mcx.get_spot_recent()
type(df)   # 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 from 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

mcx_data-1.1.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

mcx_data-1.1.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file mcx_data-1.1.1.tar.gz.

File metadata

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

File hashes

Hashes for mcx_data-1.1.1.tar.gz
Algorithm Hash digest
SHA256 9c8220ca20f346379d1d5bba988f0cf26dcf678f779b4cc314f4a1c02c1c97eb
MD5 809bbf4145332d9a059c6ba6661f86db
BLAKE2b-256 1b9b6ba40f103ab61e1b700fc14a1bee7ffb520cd1567582d3b6c8e193b92403

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcx_data-1.1.1.tar.gz:

Publisher: publish-mcx.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 mcx_data-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: mcx_data-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mcx_data-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 64bd414b0ab3d1fcb9d996fc65e4c9f6ba035f883b2a486d75b7ed4962f5844f
MD5 004e3d54374e38956823305c953cfbf4
BLAKE2b-256 af65c12eb79b73230a474d5c7f0ea99e107aff326e8ad5c8065eed670f4b0f0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcx_data-1.1.1-py3-none-any.whl:

Publisher: publish-mcx.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