Real-Time Market Data Ingestion & Insider Trading Dashboard: Open-Source NSE API Wrapper
pnsea, my open-source Python library for live NSE data, and the private FastAPI backend on Railway that uses it.
Verified Engineering Benchmarks
In short: Commercial NSE data feeds cost up to ₹20 lakh a year, and the free endpoints break on anti-scraping headers and session timeouts. I built pnsea, a free open-source Python library that handles the exchange session and returns option chains, equity quotes and insider disclosures as Pandas DataFrames. A private FastAPI service on Railway uses it to total promoter buying and selling in crores. Hosting costs $5-15 a month.
Background
Live data from the National Stock Exchange (NSE), such as option chains, implied volatility surfaces, equity quotes and insider trading disclosures, usually means a commercial vendor feed that costs up to ₹20 lakh ($24,000) a year.
The free PyPI packages for NSE data are often broken or abandoned, or they fail at the 9:15 AM IST market open because they don’t warm up a session, don’t handle cookie expiry or don’t send the right headers.
I wrote pnsea, a free, open-source Python library that handles session cookies, gets past the anti-scraping checks and turns the raw exchange JSON into Pandas DataFrames.
For my own analytics I run a private FastAPI service on Railway ($5-15/mo) on top of pnsea. It totals promoter buying and selling in crores over 7, 30 and 90 days and feeds a live Astro dashboard on Vercel ($0).
How it works
- • Session Warmer Protocol & Ephemeral Cookie Rotator
- • Exchange Raw JSON to Pandas DataFrames Normalization
- • Full Coverage: Option Chains, Equity Quotes, Index Weights, Insider Disclosures
- • Aggregates Promoter Insider Trading Volume (Calculates Net Value in Crores)
- • Historical Snapshots stored in NeonDB (Serverless Postgres)
- • REST API Endpoints with Asynchronous Ingestion Pipelines
Details
-
pnseaOpen-Source Core Library:- Session Warming Protocol: Automatically fetches root landing endpoints to acquire valid
bm_svand session cookies before querying data routes. - Pandas Native Output: Converts complex nested JSON payloads (Option Chains, SAST disclosures, Form 7 filings) directly into clean Pandas DataFrames (
df = nse.get_option_chain("NIFTY")). - On PyPI: installable with
pip install pnsea, and maintained.
- Session Warming Protocol: Automatically fetches root landing endpoints to acquire valid
-
Private FastAPI Ingestion Instance (Railway):
- Deployed on Railway ($5–$15/mo), the private FastAPI service runs scheduled background tasks using
pnsea. - Ingests corporate insider trading disclosures, converts share quantities and transaction prices into net INR values, and aggregates promoter accumulation trends in crores (1 crore = ₹10 million).
- Deployed on Railway ($5–$15/mo), the private FastAPI service runs scheduled background tasks using
-
High-Speed Analytics Dashboard (Vercel):
- Charts and tables served from Vercel at $0 hosting.
Results
- No vendor fees: I no longer pay for a data feed. Commercial NSE feeds cost up to ₹20 lakh a year.
- Open source:
pnseais a free PyPI package. - Running cost: $5-15 a month in total for the backend and the dashboard (Railway and Vercel).
- Ready-to-use data: every call returns a DataFrame, so analysis can start straight away.
Need something like this?
I build data pipelines that get past anti-bot blocks, iOS apps from web apps, and SaaS MVPs.
Start a Project →