SkillAgentSearch skills...

Skill Algotrader

Quantitative trading skill for Indian equity markets with Zerodha integration. Generate trading bots, fetch live index data, and manage risk with Claude Code.

Install / Use

npx skills add javajack/skill-algotrader

Installs into whichever agent you are using.

About this skill

Quality Score

0/100

Supported Platforms

Claude Code
Claude Desktop

README

AlgoTrader: Quantitative Trading Skill for Claude Code

Comprehensive trading expert embodying real-world learnings from Indian equity markets

Python Zerodha License Skills.sh GitHub

Overview

AlgoTrader is a Claude Code skill that provides expert guidance for building, optimizing, and running quantitative trading systems on Indian stock markets. It embodies 1,780 lines of real-world learnings from production trading, including:

  • 65%+ win rate signal generation strategies
  • 28x performance optimizations (Parquet caching, vectorization)
  • Zero-regression code modifications with automated testing
  • Production failure prevention (30+ gotchas documented)
  • Backtest-live parity validation
  • Risk-adjusted capital compounding

Installation

Quick Install (Recommended)

Install directly from the skills.sh directory:

npx skills add javajack/skill-algotrader

Manual Installation

Option 1: Clone to Claude Skills Directory

cd ~/.claude/skills
git clone https://github.com/javajack/skill-algotrader.git algotrader
cd algotrader
./start.sh wizard  # Start using the skill

Option 2: Custom Skills Path

export CLAUDE_SKILLS_PATH=~/work/skills
cd ~/work/skills
git clone https://github.com/javajack/skill-algotrader.git algotrader
cd algotrader
./start.sh wizard

Install Python Dependencies

After installation, set up the Python environment:

cd ~/.claude/skills/algotrader  # or your custom path
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# Or use the convenience script (auto-creates venv)
./start.sh wizard

Features

🎯 Interactive Bot Generation Wizard

Launch /algotrader without parameters to enter the wizard:

$ /algotrader

╔══════════════════════════════════════════════════════════════╗
║              ALGOTRADER BOT GENERATION WIZARD                ║
╚══════════════════════════════════════════════════════════════╝

Scanning current directory for trading code...
✓ Found: backtest.py, signal_generator.py

What would you like to do?
  1. Generate new trading bot from scratch
  2. Enhance existing code (fix issues, optimize)
  3. Create universe JSON from live index data
  4. Run backtest comparison
  5. Analyze performance

> 1

Let's design your trading bot. I'll ask a few questions...

The wizard will:

  • Scan your folder for existing trading code
  • Ask strategic questions (trade type, universe, capital, risk tolerance)
  • Generate a complete, working trading bot
  • Create universe JSON files with latest index constituents
  • Set up logging, analytics, and risk management

📊 Universe Fetcher (Live Index Data)

Automatically fetches latest index constituents from NSE:

/algotrader universe

Fetching live index data from NSE...
✓ Nifty 50: 50 stocks (updated: 2026-02-14)
✓ Nifty 100: 100 stocks
✓ Nifty Midcap 150: 150 stocks
✓ Nifty Smallcap 250: 250 stocks

Created:
  └─ universe/
     ├─ nifty50.json (50 stocks, ₹500Cr+ mcap)
     ├─ nifty100.json (100 stocks)
     ├─ midcap150.json (150 stocks, ₹50-500Cr mcap)
     └─ smallcap250.json (250 stocks, ₹10-50Cr mcap)

Each file includes:
  - Symbol, company name, ISIN
  - Market cap, sector
  - Liquidity metrics (avg volume, spread)
  - Last updated timestamp

🧠 16 Knowledge Domains

  1. Zerodha Integration - Tick size rounding, position reconciliation, SL lifecycle
  2. Backtest-Live Parity - Data caching, T vs T-1 alignment, VWAP reset
  3. Signal Generation - Fortress signal (65% win rate), multi-factor confirmation
  4. Rebalancing Logic - Weekly vs daily, transaction cost modeling
  5. Stock Universe Selection - Liquidity filtering, momentum scoring
  6. Performance Optimization - Parquet (28x), Polars vectorization (37x), API batching
  7. Indian Market Specifics - Session timing, circuit breakers, T+1 settlement
  8. Failure Patterns - 5 production issues + fixes (HINDALCO loop, naked positions)
  9. Indicators & Formulas - RSI, MACD, ATR, ADX, VWAP, EMA (exact formulas + parameters)
  10. Multi-Timeframe Trading - Intraday vs positional, MTF alignment
  11. Logging & Observability - Structured logging, real-time monitoring
  12. Post-Trade Analytics - P&L breakdown, Sharpe ratio, drawdown analysis
  13. Signal Attribution - Track which indicator triggered, exhaustion detection
  14. Exit Strategies - Time decay, trailing stops, partial exits
  15. Risk Management - Kelly Criterion, portfolio heat, consecutive loss throttling
  16. Capital Compounding - Market regime detection, bull market amplification

⚠️ 30+ Token-Burning Gotchas (NUANCES.md)

Common mistakes that burn hours of debugging:

🔥 CRITICAL: Tick Size Rounding
Mistake: kite.place_order(price=1847.35, ...)
Error: "Tick size for this script is 5.00"
Fix: price = round(price / tick_size) * tick_size  # 1847.35 → 1850.00
Impact: 90% of order rejections are tick size errors

🔥 CRITICAL: VWAP Must Reset Daily
Mistake: Cumulative VWAP across days
Symptom: Backtest 65% win rate, live 40%
Fix: Reset at market open (9:15)
Impact: #1 cause of backtest-live parity violations

See NUANCES.md for all 30+ gotchas.

Configuration

Configure Zerodha API Credentials

For live trading, create a .env file in your bot directory:

# Create .env file (never commit this!)
cat > .env << EOF
KITE_API_KEY=your_api_key
KITE_API_SECRET=your_api_secret
KITE_ACCESS_TOKEN=your_access_token
EOF

Get credentials from: https://kite.trade/

Note: The .env file is automatically excluded from git via .gitignore. Never commit API credentials!

Quick Start

Generate Your First Trading Bot

# Launch wizard
/algotrader

# Or directly in Claude Code chat
> /algotrader wizard

The wizard will ask:

  1. Trading Style: Intraday, Swing (multi-day), Positional (multi-week)
  2. Universe: Nifty 50 (largecap), Nifty Midcap 150, Custom
  3. Strategy: Momentum, VWAP Pullback, Opening Range Breakout
  4. Capital: Starting capital and risk per trade
  5. Risk Tolerance: Conservative (0.5% risk), Balanced (1%), Aggressive (2%)

Based on your answers, it generates:

trading_bot/
├── config.json          # Strategy parameters
├── main.py             # Entry point
├── signal_generator.py # Signal logic
├── data_manager.py     # Data fetching and caching
├── risk_manager.py     # Position sizing, Kelly Criterion
├── zerodha_client.py   # API integration
└── universe/
    └── nifty50.json    # Stock universe (fetched from NSE)

Fetch Universe from Live Data

/algotrader universe --indices nifty50,nifty100,midcap150

# Creates JSON files with latest constituents
# Includes liquidity filtering, market cap, sector

Analyze Existing Code

# Point to your existing trading code
/algotrader check ./my_trading_bot.py

# Output:
⚠️  Found 3 issues:
1. Tick size not rounded (line 45) - will cause order rejections
2. VWAP not reset daily (line 89) - backtest-live parity violation
3. No symbol cooldown (line 120) - risk of revenge trading

Recommended fixes:
  1. Add tick_size rounding: price = round_to_tick(price, symbol)
  2. Reset VWAP at 9:15: if is_new_day(): vwap_state.reset()
  3. Add 45min cooldown: if not can_trade_symbol(symbol): return None

Apply fixes automatically? (y/n):

Usage Examples

Example 1: Fortress Signal Generation

from algotrader import generate_fortress_signal

# Your OHLCV data with indicators
df = load_data("RELIANCE", date="2026-02-14")

signal = generate_fortress_signal(
    df=df,
    symbol="RELIANCE",
    config={
        'rsi_long_min': 45,
        'rsi_long_max': 65,
        'adx_min': 25,
        'volume_mult': 1.5
    }
)

if signal:
    print(f"🎯 LONG signal for {signal['symbol']}")
    print(f"   Entry: ₹{signal['entry_price']}")
    print(f"   Stop Loss: ₹{signal['stop_loss']}")
    print(f"   Target: ₹{signal['target']}")
    print(f"   Confidence: {signal['confidence']:.0%}")
    print(f"   Reason: {signal['reason']}")

Example 2: Backtest Comparison

from algotrader import compare_backtests

# Compare backtest results with live trading
comparison = compare_backtests(
    backtest_file="backtests/fortress_v2.parquet",
    live_file="backtests/live_results.parquet"
)

print(f"Win Rate: {comparison['backtest_winrate']:.1%} → {comparison['live_winrate']:.1%}")
print(f"Delta: {comparison['winrate_delta']:.1%}")

if comparison['parity_issues']:
    print("\n⚠️  Parity Issues:")
    for issue in comparison['parity_issues']:
        print(f"  - {issue['description']}")
        print(f"    Fix: {issue['recommended_fix']}")

Example 3: Universe Fetcher (Programmatic)

from algotrader.universe import fetch_index_constituents, filter_universe

# Fetch latest Nifty 50 from NSE
nifty50 = fetch_index_constituents("NIFTY 50")
print(f"✓ Fetched {len(nifty50)} stocks")

# Apply liquidity filtering
filtered = filter_universe(
    nifty50,
    min_volume=100_000,      # Min daily volume
    max_spread_pct=0.3,      # Max bid-ask spread
    min_atr_pct=0.15,        # Min volatility
    max_atr_pct=2.5          # Max volatility
)

print(f"✓ After filtering: {len(filtered)} stocks")

# Save to JSON
save_universe(filtered, "universe/nifty50_filtered.json")

Architecture

Minimal Design Philosophy

AlgoTrader follows these principles:

  1. Few files, high cohesion - 7 file

Related Skills

View on GitHub
GitHub Stars88
CategoryDevelopment
Updated9d ago
Forks24

Languages

Python

Security Score

85/100

Audited on Jul 29, 2026

No findings