Skip to main content

bseindia 1.0.0

A Python library for fetching publicly available market data from the BSE India website and API endpoints. It wraps the CSV/JSON/HTML feeds that power bseindia.com and returns clean pandas DataFrames (or Python dicts) ready for analysis.

Tested on Python 3.9+. Data is scraped from public BSE endpoints — be mindful of request rates.


Installation

Fresh install:

pip install bseindia

Upgrade:

pip install bseindia --upgrade

Dependencies

Installed automatically via pip:

  • requests
  • pandas (>= 2.0.0)
  • numpy
  • beautifulsoup4
  • lxml
  • xlrd

Quick start

import bseindia

# Trading holiday calendar for the equity segment
holidays = bseindia.trading_holiday_calendar()

# Full BSE equity security master (cached locally to bse_security_list.csv)
securities = bseindia.all_listed_securities()

# Historical price/volume for a stock
from bseindia import equity
hist = equity.historical_stock_data(symbol="SBIN", period="1M")

# Today's bulk deals
deals = equity.bulk_deal_as_on_today()

# Derivatives bhavcopy for a given trade date
from bseindia import derivatives
fo_bhav = derivatives.derivative_bhav_copy(trade_date="01-07-2024")

Dates are always dd-mm-YYYY strings (e.g. "10-06-2024").


API reference

Top level — bseindia

Function Purpose
trading_holiday_calendar(year=None) BSE equity-segment holiday list. Optional year filter.
all_listed_securities(refresh=False) Equity security master (security_code, symbol, isin_no, group, …). Cached locally; pass refresh=True to re-download.

Equity — bseindia.equity

Function Purpose
historical_stock_data(symbol, from_date=None, to_date=None, period=None) Historical OHLCV for a symbol. Supply either from_date/to_date or period (1D, 1W, 1M, 3M, 6M, 1Y).
stock_info(symbol) Quote-header dict for a symbol (face value, group, market cap, 52w high/low, …).
equity_bhav_copy(trade_date) CM-UDiFF bhavcopy for the given trade date, as a DataFrame.
equity_turnover() Year-wise equity turnover key statistics.
equity_segment_history() Yearly equity-segment history (listed companies, trades, turnover) from 1997‑98 onwards.
category_wise_turnover(period='monthly', month='01', year='2026', from_date=..., to_date=...) Category-wise turnover. period can be 'monthly', 'yearly', or range-based (provide from_date/to_date).
market_cap() Yearly market-capitalisation key statistics.
market_capitalisation() Current market cap by instrument type (Equity, REIT/INVIT, ETF, MF, Corporate Bonds, CP). Values in ₹ Crores.
top_market_cap() Top 100 companies by market capitalisation.
gross_delivery(trade_date) Gross delivery report for the given date (scrip-wise delivery qty, value, turnover, %).
bulk_deal_as_on_today() Today's bulk deals.
block_deal_as_on_today() Today's block deals.

Derivatives — bseindia.derivatives

Function Purpose
market_summary() F&O market summary. Returns a tuple (index_df, equity_df).
derivative_bhav_copy(trade_date) Derivatives UDiFF bhavcopy for the given trade date.

Examples

Holidays for a specific year

bseindia.trading_holiday_calendar(year=2026)

Historical data by date range

from bseindia import equity

equity.historical_stock_data(
    symbol="SBIN",
    from_date="01-06-2023",
    to_date="10-06-2023",
)

Historical data by period

equity.historical_stock_data(symbol="TCS", period="6M")

Bhavcopy

equity.equity_bhav_copy(trade_date="01-07-2024")

Derivatives market summary

from bseindia import derivatives

index_df, equity_df = derivatives.market_summary()

Look up a scrip code

all_listed_securities() returns the full master. Pass refresh=True to bypass the local cache and re-fetch from BSE.

bseindia.all_listed_securities(refresh=True)

Notes & gotchas

  • BSE endpoints sometimes rate-limit or time out; functions raise NSEdataNotFound or CalenderNotFound in those cases. Retry after a short pause.
  • historical_stock_data resolves a symbol to a BSE scrip code via the cached security master, with a live smart-search fallback if the symbol is missing. Numeric inputs (e.g. "500325") are treated as scrip codes directly.
  • The security master is cached at bseindia/bse_security_list.csv inside the installed package directory.
  • All date inputs use the dd-mm-YYYY format unless otherwise noted.

Contributing

Issues and pull requests are welcome on the GitHub repo.

  • Bug reports / feature requests — open an issue at https://github.com/RuchiTanmay/bseindia/issues.
  • Patches — fork, branch, commit, open a PR against main.
  • Docs & examples — blog posts, notebooks and Q&A help the community; please share links in issues so they can be referenced.

Changelog

See CHANGE_LOG.md for release history.

License

Distributed under the terms of the LICENSE bundled with this repository.

Metadata

Release files for bseindia 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 bseindia 1.1
File Size Uploaded
bseindia-1.1.tar.gz 19.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bseindia 1.1
File Interpreter ABI Platform
bseindia-1.1-py3-none-any.whl Python 3 none any Details

Total release size: 40.4 kB

Release files / bseindia-1.1.tar.gz

Download URL bseindia-1.1.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
63fb1a55d1e9ba71d9de5645e92ee7689ab56b108c7c0ae15b266f062a11021f
BLAKE2b-256 checksum
How to use checksums
ae6771afe3ef42b82b33eb9f7aff65325fa7052100aebf740169249fee560ba2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / bseindia-1.1-py3-none-any.whl

Download URL bseindia-1.1-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d2c834aaec5fb908131a396731247f9b1eca59b35af9daf89d4176c1960ef63
BLAKE2b-256 checksum
How to use checksums
fb6bd3e489249b019fa87e42fa254bdb73de30dd3b855bca2f0dc0d7c7ec5dad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

1.1 This release

2 release files

0.1

2 release files

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