NIFTY ATM Edge
An AI agent that checks each trading morning whether buying at-the-money NIFTY 50 options has a real mathematical edge that day, and emails me the verdict before I trade.
- Node.js
- PowerShell 7
- Claude Code
- NSE market data
- Options Greeks
- Task Scheduler
- Gmail
The problem
Buying options intraday is a race against time. Every minute the option loses value to time decay (theta), and the price has to move fast enough to beat that decay. Most option buyers lose money because they trade on gut feel, on days when the market is quiet and volatility is shrinking.
I wanted a disciplined, repeatable answer to one question each morning: is today a day when buying ATM options has positive expected value?
What it does
Collects live market data. From the open, it snapshots the NSE option chain, India VIX and index levels every 5 minutes.
Runs five filters. A trade qualifies only if at least 4 of 5 pass:
- IV velocity: is implied volatility rising faster than time decay eats the premium?
- Move vs breakeven: is the expected price move over the holding window big enough to pay for theta, volatility drift and trading costs?
- Order flow: is open interest showing shorts covering or buyers entering, rather than option sellers adding supply?
- Gamma: is option sensitivity to price elevated compared with the last 5 sessions?
- Microstructure: have bid-ask spreads tightened, with a real volume spike?
Does the expectancy math. For a call, a put and a straddle it calculates win probability, breakeven moves and net expected value in points and rupees per lot.
Estimates the market regime. It assigns probabilities to four states: slow range, compression breaking into expansion, fast trend, and erratic chop.
Decides and reports. It gives one verdict: ATM CALL, ATM PUT, ATM STRADDLE or NO TRADE. The report includes the exact levels that would change the call, and it’s emailed automatically.
How it’s built
Windows Task Scheduler (weekdays)
09:12 -> Data collector (Node.js), NSE snapshots every 5 min
09:30 -> Claude AI agent -> quant engine -> report -> Gmail + desktop notification
11:00 -> re-runs only if 09:30 said NO TRADE
- Quant engine (Node.js). It calculates the Greeks directly from the straddle price. It interpolates between the two strikes around spot to get a smooth at-the-money reading, and it checks realized volatility against implied volatility.
- AI agent (Claude Code). It runs the engine, reads the day’s economic calendar and global cues, and writes a report in a fixed format. Every number comes from the code, never from the model’s guesswork, so each result can be reproduced.
- Automation (PowerShell 7 and Task Scheduler). It skips weekends and NSE holidays, and sends a failure alert so a broken run never looks like a quiet day.
Engineering decisions I’m proud of
Deterministic math, AI for judgment. The model never invents a figure. It interprets numbers the code has computed. That separation makes the system auditable.
Validated by replaying real data. I replayed a full trading day snapshot by snapshot and found flaws in my own rules:
- One filter could only ever pass on expiry day.
- Another counted option sellers as a bullish signal for buyers.
I redesigned both and confirmed with the replay that the filters now respond to real changes in the market.
Built to fail loudly. It sends failure emails and keeps logs for every run.
Skills demonstrated
Quantitative modeling of volatility, gamma and theta · Market-microstructure analysis · AI agent design · Workflow automation · Data engineering · Risk-first system design
This is a personal research and decision-support tool, not financial advice.