All work
Trading Automation

CE/PE Options Terminal: Multi-User Index-Options Automation

A FastAPI terminal that charts real option premiums, scores a rules-based CE/PE setup, and runs live Zerodha order automation per client.

Built to escape Pine's constant-symbol limit; evolved into a multi-user production app with admin-issued logins, per-client dedicated egress IPs for broker whitelisting, hard-blocked privilege separation and a deploy script that refuses while a trade is open.

CE/PE Options Terminal: Multi-User Index-Options Automation — illustration
What makes it serious
  • Real option-chain premiums charted where Pine cannot
  • Multi-user with admin-issued access windows and donor market data
  • Dedicated egress IP per client to satisfy broker whitelisting
  • Deploy script refuses while any trade is open

TradingView cannot quote an option strike that a script computes at runtime, and it caps scripts at 40 data requests, so a 37-strike chain is impossible in Pine. The CE/PE Terminal was built to do what Pine cannot: pull real premiums for any strike from a broker API, align them to the index on shared timestamps, chart them with lightweight-charts and evaluate a four-setup CE/PE strategy. Early sessions were measured honestly: the spec as given lost money, and two structural reasons were documented for the client.

The app then became a production system. It is a multi-user FastAPI service with live-only Zerodha order automation, an admin who issues client logins with access windows, and the admin's broker session acting as the market-data donor so clients need no data subscription. Because Zerodha refuses one IP whitelisted against two trading accounts, each client gets a dedicated reserved egress address, provisioned on demand by a root-owned timer since the service runs with NoNewPrivileges. The strategy legs are derived from the 09:15 open on the strike grid with a helper that is the single source of truth, after a subtle rounding mismatch was found.

Deploys go through a script that backs up, refuses if any user has an active trade, and restarts the service.

Executes live broker orders; shared as engineering work, not financial advice.

How it works

  1. Admin creates a client login; an egress IP is reserved for them
  2. Client whitelists that IP and completes the daily broker login
  3. At 09:15 the two legs are fixed from the opening price on the strike grid
  4. Engine streams premiums, scores the setup and places one trade per day
  5. Positions are exited on rules even if the client's access window has expired
Stack
PythonFastAPIlightweight-chartsAngel One SmartAPIZerodha Kite ConnectsystemdGCPCloudflare Tunnel

Software and automation are infrastructure, not financial advice. No performance guarantees. Every live system needs staged testing, risk limits, and owner approval.

#options#nifty#zerodha#angel-one#fastapi#automation#india