Autonomous multi-strategy algorithmic trading system for Indian markets (NSE), built with Node.js.
It combines market data, curated financial news sentiment, and Anthropic Claude-based decision logic with strict risk controls and paper-trading analytics.
- Multi-strategy decisioning for F&O intraday and equity swing logic.
- Claude-powered macro bias, sentiment scoring, and trade recommendations.
- Curated financial news ingestion (CNBC-TV18, ET, Mint, Moneycontrol, NSE, and more via domain filters).
- Strict risk framework: per-trade allocation cap, mandatory SL/TP, and daily drawdown halt.
- IST market scheduler (pre-market, live loop, square-off, post-market analysis).
- Paper-trading mode with deep JSONL telemetry and daily analytics reports.
- Optional Redis-backed state store (falls back to in-memory).
src/app.js: Bootstrap and dependency wiring.src/scheduler.js: Indian market-hours cron orchestration.src/tradingEngine.js: Core execution loop, paper/live handling, risk checks, logging.src/aiEngine.js: Anthropic client and strict JSON response parsing.src/growwClient.js: Groww REST integration with exponential backoff.src/newsClient.js: Multi-provider + curated-domain financial news collector.src/riskManager.js: Position sizing, SL/TP enforcement, drawdown checks.src/store.js: In-memory/Redis state for positions and daily trading context.
- Node.js
>=18.18.0(recommended) - npm
- API keys for Anthropic + News provider(s)
- Groww credentials for live market data / live execution
Note: On older Node versions,
npm run devmay fail due to--watch. Usenpm start.
- Install dependencies:
npm install- Copy and configure environment variables:
cp .env.example .env- Update required keys in
.env:
ANTHROPIC_API_KEYNEWSAPI_KEY(for curated/newsapi mode)- Groww keys/tokens for market data or live execution
Production mode:
npm startDevelopment mode (Node 18+):
npm run devSet in .env:
ENABLE_LIVE_TRADING=false
PAPER_TRADING=true
PAPER_TRADING_SLIPPAGE_PCT=0.05Then run:
npm startPaper mode behavior:
- Simulates order placement and square-off.
- Tracks positions and realized PnL in internal state.
- Produces structured logs for analysis.
paper_trades.jsonl: Paper order + square-off events.deep_analysis.jsonl: Per-cycle telemetry, API timings, decisions, rejections, risk events.paper_daily_report.jsonl: End-of-day summary metrics (PnL, win rate, profit factor, etc.).
These files are ignored by git via .gitignore.
08:30Pre-market: macro scan + news analysis.09:15to15:30Live cycle loop.15:15Intraday/F&O forced square-off.15:30to17:00Post-market reporting windows.
- Max trading capital from
MAX_TRADING_AMOUNT. - Single high-risk F&O trade allocation capped at
10%(or lower if configured). - Mandatory stop-loss and target enforcement on each trade.
- Global halt when daily drawdown breaches
DAILY_MAX_DRAWDOWN_PCT.
- Groww endpoints in the client are scaffold-style and may need alignment with your exact broker API contract.
- This project is for educational/research use. Validate thoroughly in paper mode before enabling live trading.
- You are responsible for regulatory and broker compliance.