An automated command-line assistant designed to help NIFTY options traders make informed decisions. It connects to your active Zerodha Kite and Sensibull browser tabs, extracts live technical chart indicators and options metrics, and passes them to OpenAI GPT-4o-Mini (via Genkit) to synthesize a short, systematic, and highly actionable trading dashboard card.
- Shared Browser (CDP): The script attaches to a running session of Google Chrome via the Chrome DevTools Protocol (CDP) on port
9222. This bypasses complex 2FA logins and CAPTCHAs, running the script safely alongside your active trading routine. - Sensibull Scraping: The script intercepts the intraday option chain responses (
/compute_intraday) to gather spot price, Put-Call Ratio (PCR), Open Interest (OI) changes, Max Pain, and Implied Volatility (IV). - Zerodha Chart Scraping: The script reloads the chart window to fetch the latest tick candle, toggles the Table View panel inside the chart iframe, downloads the indicators in memory, and reads CPR (Pivot, BC, TC), ATR, and ADX/DMI (+DI, -DI).
- AI Generation: The script merges these datasets and feeds them to OpenAI, generating a highly structured options strategy specifying support/resistance levels, exact trade setups (triggers, entries, stop-losses, and targets) for three trade plans, institutional strike positioning, and daily golden rules.
- Continuous Loop: By default, it updates and prints a fresh double-bordered dashboard strategy card in your terminal every 5 minutes.
- Node.js (v18 or higher)
- Google Chrome
- OpenAI API Key (Get one from OpenAI Platform)
-
Clone the Repository:
git clone https://github.com/ssbushi/traderApp.git cd traderApp -
Install Dependencies:
npm install
-
Configure Environment Variables: Create a
.envfile in the root directory:OPENAI_API_KEY=your_openai_api_key_here CDP_HOST=127.0.0.1 CDP_PORT=9222 INTERVAL_MINUTES=5
Before launching, close all existing Chrome windows completely.
- macOS:
Open Terminal and run:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir="/Users/ssbushi/ChromeDevSession"
- Windows (Command Prompt / CMD):
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="C:\ChromeDevSession"
- Windows (PowerShell):
& "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="C:\ChromeDevSession"
In the debugging browser window that opened:
- Log into Zerodha Kite and open the NIFTY spot chart. Make sure ChartIQ charts are enabled, and your indicators (CPR, ADX, and ATR) are loaded onto the chart layout.
- Log into Sensibull and open the Options Chain page.
You can start the script in two different modes:
-
Standard (Quiet) Mode: (Hides detailed browser interactions, printing only grey success lines and the final colorized strategy report):
npm start
-
Debug Mode: (Outputs all intermediate reload sequences, frame queries, network intercepts, and element diagnostics in real time):
npm run debug
| Variable | Default | Description |
|---|---|---|
OPENAI_API_KEY |
Required | API key for OpenAI access. |
CDP_HOST |
127.0.0.1 |
The host running Chrome DevTools Protocol. |
CDP_PORT |
9222 |
The debugging port Chrome is listening on. |
INTERVAL_MINUTES |
5 |
Time interval (in minutes) between analysis updates. |
ZERODHA_DOWNLOAD_SELECTOR |
Dynamic | Optional. Overrides default selectors used to click the Zerodha CSV export button. |
├── package.json # Project dependencies & launch scripts
├── tsconfig.json # TypeScript compiler configurations
├── index.ts # Entrypoint, custom markdown renderer & quiet loop
├── browser/
│ ├── connection.ts # CDP session connection & browser OS instructions
│ ├── sensibull.ts # Intraday options metrics network interception
│ └── zerodha.ts # Chart iframe download trigger, CSV parser, and reloads
├── utils/
│ └── logger.ts # Logger utility for debug flag and info logging
└── ai/
├── genkit.ts # Genkit configuration & Zod output schemas
└── prompts.ts # Model prompt construction & strategy generation