A robust, production-ready package to fetch options chain data from NSE and BSE with circuit breakers and retries.
Project description
indian_options_fetcher
A robust, production-ready library to reliably fetch options chain data from the National Stock Exchange (NSE) and Bombay Stock Exchange (BSE) of India.
Features a robust HTTP fetching architecture using curl_cffi to avoid bot detection, circuit breakers to prevent continuous blocking, and exponential backoff.
Features
- Anti-Bot Evasion: Uses
curl_cffito mimic Chrome fingerprints. - Circuit Breaker: Automatically backs off temporarily if the exchange endpoints block the IPs repeatedly, preventing permanent bans.
- Smart Data Extraction: Filters for At-The-Money (ATM) options and extracts only the relevant data window to reduce memory usage.
- Unified Logic: Both NSE and BSE fetching use the same robust retry/timeout mechanics.
- Asynchronous APIs: Allows for async integration using
asyncioto prevent blocking the main thread.
Installation
pip install indian_options_fetcher
Usage
import asyncio
from indian_options_fetcher import fetch_nse_option_chain_compact, fetch_bse_option_chain
async def main():
# Fetch NSE Data for NIFTY
nse_data = await fetch_nse_option_chain_compact("NIFTY", is_index=True)
print("NSE ATM Strike:", nse_data["atm_strike"])
# Fetch BSE Data for SENSEX (Scrip Code 1 for SENSEX)
bse_data = await fetch_bse_option_chain(expiry="25 Jun 2026", scrip_cd="1")
print("BSE DataFrame Shape:", bse_data.shape)
if __name__ == "__main__":
asyncio.run(main())
License
MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file indian_options_fetcher-0.1.0.tar.gz.
File metadata
- Download URL: indian_options_fetcher-0.1.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dc0db783bfa57e929569ed91cfa7756ccc3a97160dece696959d8794e4f2aaf
|
|
| MD5 |
bdff4ff5b4832bab8fb70c9c796f9bbb
|
|
| BLAKE2b-256 |
70cfbe84e11a8e0f3ffbdf31167580c3af5f3995b548d89981b6d6e7feb93104
|
File details
Details for the file indian_options_fetcher-0.1.0-py3-none-any.whl.
File metadata
- Download URL: indian_options_fetcher-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19bbe3bb4f209c62c03fdcdc62f6d2211b011f398c7bc86f38c4a14c7e09515b
|
|
| MD5 |
465cbbdb5034efa39afbb8119a867785
|
|
| BLAKE2b-256 |
034d2b17ca32bb5fd6d8c3fbf42ad975c2e1e58f43b6fad288af31ed62af77f3
|