Unreal Brains Logo Unreal Brains
← Back to All Work
Market data • 2025

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.

Target Domain Own project, open source

Verified Engineering Benchmarks

License & Data Fees
$0 / month
100% Free & Open-Source PNSEA
Infrastructure Spend
$5 - $15 / month
Railway (FastAPI) + Vercel stack
Data Structuring
Pandas Ready
Direct DataFrame conversion
Market Volatility
None observed
Session warming at 9:15 AM IST open

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

Data Ingestion Engine PNSEA Core (PyPI)
  • • Session Warmer Protocol & Ephemeral Cookie Rotator
  • • Exchange Raw JSON to Pandas DataFrames Normalization
  • • Full Coverage: Option Chains, Equity Quotes, Index Weights, Insider Disclosures
↓
Private Analytics Microservice FastAPI on Railway ($5-$15/mo)
  • • Aggregates Promoter Insider Trading Volume (Calculates Net Value in Crores)
  • • Historical Snapshots stored in NeonDB (Serverless Postgres)
  • • REST API Endpoints with Asynchronous Ingestion Pipelines
↓
Live Quantitative Insider Dashboard (Vercel)
Astro + Svelte 5

Details

  1. pnsea Open-Source Core Library:

    • Session Warming Protocol: Automatically fetches root landing endpoints to acquire valid bm_sv and 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.
  2. 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).
  3. 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: pnsea is 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 →