A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
Quantitative trading skill for Indian equity markets with Zerodha integration. Generate trading bots, fetch live index
Comprehensive trading expert embodying real-world learnings from Indian equity markets
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:
Install directly from the skills.sh directory:
npx skills add javajack/skill-algotrader
cd ~/.claude/skills
git clone https://github.com/javajack/skill-algotrader.git algotrader
cd algotrader
./start.sh wizard # Start using the skill
export CLAUDE_SKILLS_PATH=~/work/skills
cd ~/work/skills
git clone https://github.com/javajack/skill-algotrader.git algotrader
cd algotrader
./start.sh wizard
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
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:
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
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.
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!
# Launch wizard
/algotrader
# Or directly in Claude Code chat
> /algotrader wizard
The wizard will ask:
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)
/algotrader universe --indices nifty50,nifty100,midcap150
# Creates JSON files with latest constituents
# Includes liquidity filtering, market cap, sector
# 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):
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']}")
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']}")
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")
AlgoTrader follows these principles:
algotrader/
├── skill.json # Skill manifest (Claude Code integration)
├── README.md # This file
├── KNOWLEDGE.md # All 16 domains (1,780 lines of learnings)
├── NUANCES.md # 30+ token-burning gotchas
├── algotrader.py # Main CLI + wizard (~800 lines)
├── requirements.txt # Python dependencies
├── templates/
│ ├── minimal_intraday.py # Bare minimum intraday bot (50 lines)
│ └── minimal_positional.py # Bare minimum positional bot (50 lines)
└── examples/
├── full_system.py # Complete reference implementation (~300 lines)
└── universe_fetcher.py # Fetch index constituents from NSE
Comprehensive documentation of all 16 domains:
Size: 48KB, 1,780 lines Format: Markdown with code examples Usage: Searchable by keyword, cross-referenced
Token-saving precautions that prevent hours of debugging:
Summary: Read this FIRST before implementing anything.
Automatically amplifies risk in bull markets:
from algotrader.risk import detect_market_regime, calculate_position_size
# Detect regime (BULL, BEAR, SIDEWAYS)
regime = detect_market_regime(nifty_data)
# Adjust position size
base_size = 500_000 # ₹5L base
regime_multipliers = {
"BULL": 1.2, # +20% in bull market
"BEAR": 0.5, # -50% in bear market
"SIDEWAYS": 0.8 # -20% in sideways
}
position_size = base_size * regime_multipliers[regime]
# BULL: ₹6L, BEAR: ₹2.5L, SIDEWAYS: ₹4L
Optimal position sizing based on win rate:
from algotrader.risk import calculate_kelly_position
kelly = calculate_kelly_position(
win_rate=0.65, # 65% win rate
avg_win=0.012, # 1.2% avg win
avg_loss=0.006 # 0.6% avg loss
)
print(f"Full Kelly: {kelly['full_kelly']:.1%}") # 28.6%
print(f"Half Kelly: {kelly['half_kelly']:.1%}") # 14.3% (recommended)
print(f"Use {kelly['recommended']:.1%} of capital")
from algotrader.analytics import generate_daily_report
report = generate_daily_report(trades_file="logs/trades.jsonl")
print(f"📊 Daily Performance:")
print(f" Trades: {report['total_trades']}")
print(f" Win Rate: {report['win_rate']:.1%}")
print(f" P&L: ₹{report['pnl']:,.0f}")
print(f" Best Trade: {report['best_trade']['symbol']} (+{report['best_trade']['pnl_pct']:.1%})")
print(f" Worst Trade: {report['worst_trade']['symbol']} ({report['worst_trade']['pnl_pct']:.1%})")
print(f" Sharpe Ratio: {report['sharpe_ratio']:.2f}")
Before going live, ensure:
net not opening_balanceSee NUANCES.md for detailed checklist.
Real-world improvements from applying AlgoTrader patterns:
| Optimization | Before | After | Gain |
|---|---|---|---|
| Parquet caching | 2.3s load | 0.08s load | 28.7x |
| Polars vectorization | 450ms | 12ms | 37.5x |
| API batching | 15 calls | 1 call | 15x |
| Pre-computed indicators | 180ms | 90ms | 2x |
| Total backtest time | 5 min | 12 sec | 25x |
Issue: Order rejected with "Tick size error"
# Fix: Round to tick size
from algotrader.zerodha import get_tick_size, round_to_tick
tick_size = get_tick_size("RELIANCE") # 0.05
price = round_to_tick(1847.35, tick_size) # 1847.35 → 1847.35 (already ok)
price = round_to_tick(1847.33, tick_size) # 1847.33 → 1847.35
Issue: Backtest shows 65% win rate, live shows 40%
# Likely causes:
1. VWAP not reset daily - check if VWAP resets at 9:15
2. Candle completion not checked - add 500ms buffer
3. Different data sources - use same cache for both
4. Slippage not modeled - add realistic slippage (₹2-5)
# Run parity diagnostic:
/algotrader backtest compare backtest.parquet live.parquet
Issue: Same stock bought/sold repeatedly (HINDALCO loop)
# Fix: Add symbol cooldown
symbol_cooldowns[symbol] = time.time()
if time.time() - symbol_cooldowns.get(symbol, 0) < 45*60:
return None # Skip signal for 45 minutes
We welcome contributions! This skill is designed for:
MIT License - see LICENSE file
⚠️ IMPORTANT: This skill provides educational guidance for building trading systems. It does NOT:
Trading involves risk. Only trade with capital you can afford to lose.
Past performance (65% win rate, 51% CAGR) from backtests does NOT guarantee future results.
examples/ directoryBuilt with real-world trading experience. Designed for production use.
"Read NUANCES.md first. It saves 100+ debugging sessions."
Design enforcement with memory — keeps your UI consistent across a project
A Claude Code skill by Hao (駱君昊) that learns your Facebook voice and auto-posts to FB / IG / Threads / X with a 14-day c
Claude Code skill for YouTube creators — channel audits, video SEO, retention scripts, thumbnails, content strategy, Sho
AI image generation skill for Claude Code -- Creative Director powered by Gemini