Skip to main content

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_cffi to 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 asyncio to 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

indian_options_fetcher-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

indian_options_fetcher-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

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

Hashes for indian_options_fetcher-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1dc0db783bfa57e929569ed91cfa7756ccc3a97160dece696959d8794e4f2aaf
MD5 bdff4ff5b4832bab8fb70c9c796f9bbb
BLAKE2b-256 70cfbe84e11a8e0f3ffbdf31167580c3af5f3995b548d89981b6d6e7feb93104

See more details on using hashes here.

File details

Details for the file indian_options_fetcher-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for indian_options_fetcher-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19bbe3bb4f209c62c03fdcdc62f6d2211b011f398c7bc86f38c4a14c7e09515b
MD5 465cbbdb5034efa39afbb8119a867785
BLAKE2b-256 034d2b17ca32bb5fd6d8c3fbf42ad975c2e1e58f43b6fad288af31ed62af77f3

See more details on using hashes here.

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