Skip to main content

Download NSE India market data as pandas DataFrames — bhavcopy, indices, F&O, equity, debt, commodity, currency derivatives. Works on AWS Lambda and Snowflake.

Project description

nse-archives

NSE India

Download NSE India market data as pandas DataFrames.
91 datasets — bhavcopy, Nifty indices, F&O, debt, SLB, IRD, EGR.
Works on AWS Lambda and Snowflake.

PyPI version Python 3.9+ License: MIT

Download NSE India market data as pandas DataFrames or raw files to local disk / S3. Works from AWS Lambda, Snowflake, or any cloud environment.

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

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


Installation

pip install nse-archives

# With S3 support
pip install nse-archives[s3]

Quick Start

from nsedata import nse

# Get any dataset as a DataFrame
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")
df = nse.get("derivatives",    "equity",        "fo_bhav_udiff",     "2026-05-22")
df = nse.get("debt",           "tri_party_repo","trm_bc",            "2026-05-22")

# Download raw file to disk
nse.download("capital_market", "equities_sme", "bhavcopy_pr", "2026-05-22",
             output_dir="./data")

# Download to S3 (uses IAM role — no credentials needed)
nse.download("capital_market", "equities_sme", "sec_bhavdata_full", "2026-05-22",
             s3_bucket="my-bucket", s3_prefix="raw/nse/")

# List all 91 supported datasets
nse.list_datasets()
nse.list_datasets(category="capital_market")

API

nse.get(category, subcategory, dataset, date, **kwargs)  → DataFrame
nse.download(category, subcategory, dataset, date, ...)  → path or s3://uri
nse.list_datasets(category=None, subcategory=None)       → DataFrame
nse.get_config_info(category, subcategory, dataset)      → dict

CLI

# Get data as CSV
nse-data get capital_market equities_sme sec_bhavdata_full 2026-05-22
nse-data get capital_market indices ind_close_all 2026-05-22
nse-data get derivatives equity fo_bhav_udiff 2026-05-22

# Download raw file
nse-data dl capital_market equities_sme bhavcopy_pr 2026-05-22 --out ./data
nse-data dl capital_market equities_sme cvar1 2026-05-22 --out ./data --snapshot 1

# List datasets
nse-data list
nse-data list --category capital_market
nse-data list --category derivatives --subcategory equity

# Dataset info
nse-data info capital_market equities_sme sec_bhavdata_full

Dataset Categories

Category Subcategory Datasets Docs
capital_market equities_sme 26 → Capital Market
capital_market indices 2 → Indices
capital_market mutual_fund 1 → Mutual Fund
capital_market slb 10 → SLB
derivatives equity 8 → Equity F&O
derivatives commodity 3 → Commodity
derivatives currency 3 → Currency
derivatives interest_rate 9 → Interest Rate
debt corporate 13 → Debt Corporate
debt debt_segment 4 → Debt Segment
debt tri_party_repo 1 → Tri-Party Repo
egr egr 1 → EGR

Total: 91 datasets | 83 return DataFrame | 8 download-only

Notes

  • Data source: nsearchives.nseindia.com — no Cloudflare, works from any IP
  • Only available on trading days — weekends and NSE holidays return HTTP 404
  • Date format: YYYY-MM-DD for daily, YYYY-MM for monthly datasets
  • S3 upload uses IAM role — install pip install nse-archives[s3] for boto3

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 nse-archives[polars]
import os
os.environ["IMD_DATAFRAME"] = "polars"   # set before importing nsedata

from nsedata import nse
df = nse.get("capital_market", "equities_sme", "sec_bhavdata_full", "2026-05-22")
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 — see LICENSE

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

nse_archives-1.2.2.tar.gz (31.3 kB view details)

Uploaded Source

Built Distribution

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

nse_archives-1.2.2-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file nse_archives-1.2.2.tar.gz.

File metadata

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

File hashes

Hashes for nse_archives-1.2.2.tar.gz
Algorithm Hash digest
SHA256 2a6b2c53a64928a43d366b84e700af275cc9349597d15b0d7aae61c83c5b6bbd
MD5 5c507e3e08da5824af8a354d15cd9c55
BLAKE2b-256 ca64d6bd87b544de5cd01407e02760ea7efe3e2e33f30ba6f60a70e0ca84ac16

See more details on using hashes here.

Provenance

The following attestation bundles were made for nse_archives-1.2.2.tar.gz:

Publisher: publish-nse.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 nse_archives-1.2.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for nse_archives-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 47cdbffd324bcad2e2c669081d529a2d94175cd5d758519f06f183b4478e5d0e
MD5 70090ab73b7d2c76466016f934d8c640
BLAKE2b-256 6d80fdf08502d58611fa1b2d2073e2469b90a23bf212a25827b71d50c2a717ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for nse_archives-1.2.2-py3-none-any.whl:

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