NSE · F&O · Options · IST

Tej Gohel

Algo developer — live market-data & execution systems

I build the layer trading sits on: broker feeds, tick-to-bar engines, option-chain resolution, and the loop that carries a signal all the way to a squared-off position without anyone watching.

scroll — watch one trade run itself

Script to squared off

one command, one session, no hands
market feed — 5 min live
$ python main.py
[08:50] universe → 212 F&O stocks resolved
[08:51] candles_5min.db → up to date
[09:05] token → verified
[09:08] warm-up 212/212 ████████████ 100%
[09:11] feed → subscribed (212 instruments)
[09:15] first print — bars building
[09:20] strikes locked — OTM CE + PE
BUY · MISFILLED ✓
Symbol
RELIANCE
Qty
84
Signal
2,948.20
Fill
2,948.75
Slippage
+0.55
Squared off
+4,821
target hit · 13:05
illustrative
01 / Market

The tape starts

09:15. Ticks arrive as binary packets and are folded into 5-minute candles in memory, with session VWAP anchored at the open. Nothing slow runs on the socket thread — it writes numbers and marks rows dirty, and every heavier job takes its turn on a separate timer.

02 / Terminal

One command, before the bell

python main.py and then hands off. Instrument master validated, F&O universe rebuilt, candle database checked against the last completed session — because a database one day behind produces output that passes every sanity check and is quietly wrong.

03 / Warm-up

It runs itself

A fresh broker token over TOTP, verified against a live endpoint rather than trusted on its expiry claim. Then every instrument's full history is folded once into incremental state, in parallel, so the heaviest work of the day is finished before the bell rings.

04 / Entry

Signal fires, order goes

The rule is evaluated on a completed bar, once, de-duplicated per instrument. Size comes from live balance, reserve buffer and the broker's actual intraday leverage — not the assumed one. Then the entry is sent and the fill price is read back, because assuming the signal price is how a stop ends up in the wrong place.

05 / Protection

Stop and target, immediately

Both levels are set off the real fill, not the signal. From here the position is monitored on every tick: stop, target and a trail that locks profit in tiers as the trade moves. Quantity is read from the broker's net position, never from what the program believes it sent.

06 / Exit

Cut, and write it down

Whichever comes first — target, stop, or the intraday square-off deadline. Nothing drifts into the close by accident. Afterwards the feed stops, indicator state is serialised so tomorrow replays only new bars, and the day's signals are recorded so a post-market run shows exactly what came live.

Selected work

6 public repositories · Python
nse-algo-botthe pipeline above, in code

The whole loop this page walks through: market feed, per-tick evaluation, sizing against the exchange's actual intraday leverage, order placement with the fill price read back, then stop, trail, tiered profit lock, hard target and a forced square-off before the close. Position size is read from the broker's net quantity, never from what the program believes it sent. Ships without a rule — two documented scaffolds are where a strategy plugs in.

WebSocketorder executionrisk managementSQLiteFlask
OPTION-DASHBOARDoptions intelligence platform

Live option chain, futures and equity analytics with 200+ derived metrics per strike, market-regime detection, and a signal engine that scores its own accuracy afterwards. Every shipped edge was validated against multi-year studies first, not guessed.

FastAPIReactTypeScriptTimescaleDBRedisasyncio
nse-live-heatmap~200 stocks, live treemap

The entire NSE F&O universe on one screen, repainting from the market feed. Universe rebuilt daily from the exchange instrument master; previous close resolved and verified before a single tile is painted, because one wrong denominator silently recolours the whole map.

WebSocketFlaskSSEtreemap
option-strike-scannerstrike selection + live scan

Resolves which option to actually trade for every F&O stock before the open, then scans that contract's own 5-minute price — where the premium moves, not the underlying's. Strike-grid auto-detection, tick-to-bar building, session VWAP, incremental state.

WebSocketSQLiteFlaskoption chain
smc-ob-scannerindicator port, 3 runtimes

A TradingView Pine indicator reimplemented in Python bar-for-bar — pivots, structure breaks, zone construction and mitigation — then delivered three ways: a Flask dashboard, a CLI, and a standalone MQL5 expert advisor. Ships with synthetic data so it runs with no broker account.

pandasMQL5Pine ScriptMetaTrader 5
crypto-signal-scannerBinance spot

The same engine shape applied to crypto: WebSocket ingestion, SQLite candle store, SSE dashboard and Telegram alerts, wired end to end.

Binance APISQLiteTelegram

Kit

what I reach for
Python
TypeScript
React
FastAPI
Flask
pandas
TimescaleDB
Redis
Docker
Git
WebSockets
Binance API

What actually breaks

bugs that look like nothing is wrong

Market systems rarely fail loudly. They keep serving a page that looks completely normal and is completely wrong. Each of these is a real bug I shipped, found, and now guard against explicitly.

net_change → 0

The broker's change field is zero for every instrument. Trust it and the whole board reads flat, with nothing in the logs to suggest otherwise.

ohlc.close flips at 15:40

The same field means yesterday's close during the session and today's close after it settles. Read it at the wrong minute and every percentage on screen is measured from the wrong day.

Saturday − Friday = 0.00%

On a weekend "today" is still Friday. Taking the calendar date instead of the session date compares Friday against Friday and paints a perfectly plausible, perfectly flat map.

socket accepts, then closes

An account without the data add-on does not fail the handshake — it accepts the connection, takes the subscribe, and closes silently. Indistinguishable from a network blip, so a naive client reconnects all day.

token invalidates token

Issuing a new access token kills the previous one server-side, so two processes on one account keep revoking each other. Generation is throttled too, and a refusal arrives as a dropped TLS connection that reads exactly like a network fault.

stale DB, normal-looking output

A candle database one session behind produces output that passes every sanity check while being computed on yesterday's data. Freshness is asserted before anything downstream runs.