Skip to content

mimran-khan/deltaforge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeltaForge

DeltaForge

Stop watching charts. Start trading systems.

Live Dashboard

CI License: MIT Python 3.9+ Views

GitHub Stars GitHub Forks GitHub Watchers Release Issues

Twitter LinkedIn Reddit WhatsApp Telegram

Quick Start · Why DeltaForge · Features · Docs · 📊 Live Dashboard · Disclaimer


Your strategy deserves better than a spreadsheet and a prayer.

DeltaForge is an autonomous intraday options trading system for Nifty 50 on the NSE. You define the rules — it watches the market, finds entries, manages risk, sizes positions, and gets out. Paper or live, same engine, same signals, no surprises.

Works with: Angel One SmartAPI · Slack · iMessage · Telegram

Disclaimer — This is educational software, not financial advice. Options trading involves substantial risk of loss. See DISCLAIMER.md.


Quick Start

Prerequisites: Python 3.9+, macOS or Linux, Angel One trading account

git clone https://github.com/mimran-khan/deltaforge.git
cd deltaforge
make install              # venv + deps + registers `df` CLI
cp .env.example .env      # add your Angel One creds
df selftest               # verify everything works

Start paper trading:

$ df trade

[09:15:01] Engine started in PAPER mode
[09:15:02] WebSocket connected — streaming Nifty ticks
[09:22:15] SIGNAL  Stochastic Cross  BUY  conf=72
[09:22:15] RISK    9/9 gates passed
[09:22:16] ENTRY   NIFTY 24500 CE @ ₹185.40  qty=50
[10:14:33] EXIT    ₹213.20  P&L +₹1,390  (+15.0%)
[15:30:00] EOD     3 trades | Net P&L +₹3,820 | Capital ₹13,820

Go live when you're ready:

df trade --live           # requires confirmation

Why DeltaForge

Most retail options tools are either overpriced terminals you can't customize, or fragile scripts taped together with cron jobs. DeltaForge is neither.

Manual / Spreadsheet Paid Terminals DeltaForge
Execution You click buttons all day Alerts, you still click Fully autonomous — entry to exit
Risk management "I'll stop at 5% loss" (you won't) Basic SL/target 9-gate filter + independent kill switch
Position sizing Fixed lots, guesswork Basic calculators Auto-compounds with equity, scales down on drawdown
Backtesting Copy-paste into Excel Separate tool, different logic Same engine — backtest = paper = live
Alerts Check the app Email (if lucky) Instant Slack, iMessage, or Telegram
Cost Free (your time isn't) ₹2,000–₹15,000/mo Free and open source

Features

Feature Description
🧠 Multi-Strategy Engine Trend Ride, Pullback-in-Trend, Supertrend Flip, Stochastic Cross — all run in parallel with regime-aware confidence scoring
🌐 Multi-Asset Trading Nifty 50 options (NSE) + MCX Crude Oil Mini + CDS USDINR futures — each with independent risk pools
🛡️ Adaptive Risk System Daily loss limits (10%), consecutive-loss brakes, drawdown tiers, adaptive mode that adjusts confidence/lots in real-time
🔴 Kill Switch Independent watchdog process. Halts trading on breach, manual override via CLI or dashboard. Works even if the main engine hangs.
📈 Compound Sizing Scales lots with capital growth. Position sizing adapts to equity curve with configurable per-lot capital allocation.
📊 Live Dashboard FastAPI + WebSocket — capital, trades, risk status, halt toggle. All at localhost:8900
💬 Instant Alerts Slack (recommended), iMessage (macOS), or Telegram — entries, exits, errors, end-of-day P&L reports
🔄 Paper ↔ Live Parity Identical code path across backtest, paper, and live. If it works in paper, it works in production. Zero divergence.
📉 Walk-Forward Backtest 100+ day replays with production engine. Realistic costs (brokerage + STT + slippage). Compound lot sizing.
Automated Scheduling macOS launchd agent for daily auto-start, code sync, health monitoring, and session management

What It Does

graph LR
    A["📡 Angel One WebSocket"] --> B["🕯 CandleBuilder"]
    B --> C["🧠 MultiStrategyEngine"]
    C --> D{"🛡️ RiskEngine + AdaptiveMode"}
    D -->|"✅ pass"| E["💰 PositionManager"]
    D -->|"❌ reject"| F(("Skip"))
    E --> G["📊 Dashboard"]
    E --> H["💬 Alerts"]
    I["🔴 Kill Switch"] -.->|"halt"| D
    J["📡 Futures Feed"] --> K["🌐 MultiAssetEngine"]
    K --> D
Loading

Usage

# Trading
df trade                    # paper mode (default)
df trade --live             # live (confirmation required)
df trade -v                 # verbose / debug output

# Monitoring
df status                   # capital, drawdown, risk state
df logs -f                  # follow today's log
df db stats                 # per-strategy performance
df db summary               # today's trade summary

# Backtesting
df backtest --days 180      # default capital ₹10,000
df backtest --days 365 --capital 50000

# Testing & Verification
df selftest                 # pre-flight engine check
df broker                   # test broker connection
df alert "test"             # verify alert channel

# Dashboard
make dashboard              # web UI at localhost:8900
make run                    # trading + dashboard together

Configuration

Copy .env.example and fill in your credentials:

# Angel One SmartAPI (required)
ANGEL_API_KEY=your_api_key
ANGEL_CLIENT_ID=your_client_id
ANGEL_PASSWORD=your_password
ANGEL_TOTP_SECRET=your_totp_secret

# Trading
TRADING_MODE=paper
STARTING_CAPITAL=10000

# Risk Management
DAILY_LOSS_LIMIT_PCT=10          # halt after 10% daily loss
CAPITAL_PER_LOT=3000             # lot sizing aggressiveness

# Alerts — choose: "slack", "imessage", or "telegram"
ALERT_METHOD=slack
SLACK_BOT_TOKEN=xoxb-your-token
SLACK_CHANNEL_ID=C0XXXXXXXXX

All parameters live in config/settings.py and are overridable via .env. See .env.example for every configurable option.


Paper vs Live

Paper Live
Signal generation Identical engine Identical engine
Order execution Simulated (premium model) Angel One SmartAPI
Costs Realistic (brokerage + STT + slippage) Actual
Risk gates All 9 enforced All 9 enforced

Same code. Same signals. Same risk. If it works in paper, it works in live.


Documentation

Topic Description
Strategies & Indicators How each strategy generates signals, indicator reference, options model
Risk Model & Kill Switch 9-gate system, drawdown tiers, real-time monitoring, kill switch
Dashboard & API REST endpoints, WebSocket, security configuration, alerts
Architecture & Design Data flow, system components, project structure, design decisions

Live Performance Dashboard

📊 View Live Dashboard →

Auto-generated trading report with interactive equity curves, calendar heatmaps, trade analytics, and strategy breakdowns. Deployed via GitHub Pages — updated with each push.


Roadmap

Timeline Milestone
Shipped Multi-strategy engine, adaptive risk system, multi-asset (Nifty + MCX + CDS), compound sizing, automated daily scheduling, walk-forward backtesting, Slack/iMessage/Telegram alerts, FastAPI dashboard
Next BankNifty support, strategy marketplace, ML-based regime detection
Future Mobile companion alerts, cloud sync, community strategies, broker-agnostic execution

Built With


Contributing

We're building the trading system we wish existed — help us make it better.

Contribute: New strategies, risk improvements, broker integrations, indicators, bug fixes, docs


Testing

make test                   # full test suite
make test-e2e               # end-to-end only
make test-component         # component tests

License

MIT — see LICENSE. Full trading disclaimer in DISCLAIMER.md.


Your strategy deserves better than a spreadsheet and a prayer.

Star · 🔄 Share · 🤝 Contribute

About

Autonomous Nifty options trading — backtest, paper-trade, and go live with the same engine.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors