Metadata-Version: 2.4
Name: indian_options_fetcher
Version: 0.1.0
Summary: A robust, production-ready package to fetch options chain data from NSE and BSE with circuit breakers and retries.
Author: soumyashivv
Project-URL: Homepage, https://github.com/soumyashivv/indian_options_fetcher
Project-URL: Bug Tracker, https://github.com/soumyashivv/indian_options_fetcher/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: curl_cffi>=0.7.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: python-dotenv>=1.0.0
Dynamic: license-file

# 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

```bash
pip install indian_options_fetcher
```

## Usage

```python
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.
