← Back to list

python-trading-bot
by lgbarn
Luther Barnum's agent skills for trading indicators and Python bots
⭐ 0🍴 0📅 Jan 12, 2026
SKILL.md
name: python-trading-bot description: Generate, refactor, and maintain Python live trading bots for NQ futures prop firm trading (Apex Trader Funding). Supports Databento API for market data, TradersPost for execution, eval/PA modes, custom strategies, and comprehensive production features. Triggers: "live trading bot", "Python bot", "NQ bot", "futures bot", "create bot", "refactor bot", "/bot:new", "/bot:refactor", "/bot:custom". allowed-tools: Read, Write, Edit, Grep, Glob, Bash(pip:, python3:)
Python Trading Bot Skill
Generate, refactor, and maintain production-ready Python trading bots for NQ futures prop firm trading with:
- Databento API for real-time and historical market data
- TradersPost webhooks for order execution (Apex Trader Funding compatible)
- Eval and PA modes with trailing drawdown, profit targets, dynamic sizing
- 5 backtested signals + support for custom strategies
- Production features (state persistence, news filtering, alerting, comprehensive testing)
Commands
Bot Generation
| Command | Description |
|---|---|
/bot:new | Start interactive bot builder (with eval/PA mode selection) |
/bot:new <signal> | Start with signal pre-selected |
/bot:custom | Build bot with custom strategy/indicators |
/bot:keltner | Generate Keltner Channel bot (PF 10.04) |
/bot:ema | Generate EMA Cross bot (PF 6.23) |
/bot:vwap | Generate Rolling VWAP bot (PF 5.20) |
/bot:supertrend | Generate SuperTrend bot (PF 4.41) |
/bot:alligator | Generate Alligator bot (PF 4.16) |
/bot:list | Show signals with backtest metrics |
Bot Refactoring
| Command | Description |
|---|---|
/bot:refactor <bot_name> | Start interactive refactoring session |
/bot:add-feature <bot_name> <feature> | Add feature (news filter, indicator, etc.) |
/bot:remove-feature <bot_name> <feature> | Remove feature cleanly |
/bot:migrate-pa <bot_name> | Convert eval bot to PA mode |
/bot:analyze <bot_name> | Analyze code quality and suggest improvements |
Top 5 Entry Signals
| Signal | Profit Factor | Win Rate | Key Parameters |
|---|---|---|---|
| keltner | 10.04 | 87.8% | EMA=20, ATR_MULT=2.75 |
| ema_cross | 6.23 | 82.7% | Fast=3, Slow=8, Sep=0.35 |
| vwap | 5.20 | 85.3% | Window=720, Mult=1.0 |
| supertrend | 4.41 | 82.5% | Period=10, Mult=3.0 |
| alligator | 4.16 | 83.5% | Jaw=13, Teeth=8, Lips=5 |
Metrics from 219-day NQ futures backtest (May 2025 - Jan 2026) with ADX di_rising, threshold 35.
When to Use This Skill
Use this skill when:
- Creating a new live trading bot for NQ futures
- Refactoring or modifying existing trading bots
- Converting eval bots to PA mode (or vice versa)
- Adding features to bots (news filter, alerts, new indicators)
- Building custom strategies beyond the 5 pre-built signals
- Setting up Apex Trader Funding eval or PA accounts
- Implementing prop firm risk management (trailing DD, dynamic sizing)
- Testing strategies with CSV backtest before going live
Do NOT use for:
- Offline backtesting only (use Python/backtest.py instead)
- Creating platform indicators (use indicator-generator skill for TradingView/NinjaTrader/Tradovate)
- Multi-account management (run separate bot instances)
- Non-futures markets (skill optimized for NQ futures)
Generated Bot Structure
Each generated bot includes these files:
Python/bots/<signal>/
├── bot_<signal>.py # Main entry point (asyncio)
├── config.py # Configuration from .env
├── databento_client.py # Market data (Databento API)
├── traderspost_client.py # Order execution (TradersPost webhook)
├── risk_manager.py # Apex account tracking (eval/PA modes)
├── indicators.py # Self-contained indicator calculations
├── news_calendar.py # Economic calendar filtering (optional)
├── alerting.py # Email/SMS alerts (optional)
├── bot_state.db # SQLite persistence (created at runtime)
├── requirements.txt # Python dependencies
├── .env.example # Credential template
├── .gitignore # Exclude .env, logs, *.db
└── README.md # Bot documentation
Bot Architecture
┌─────────────────────────────────────────────────────────────┐
│ DATABENTO API │
│ https://databento.com (real-time & historical 2-min bars) │
│ + CSV files for backtesting │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ PYTHON BOT │
│ • Indicator calculation (EMA, ATR, ADX, signal-specific) │
│ • Signal detection (edge-triggered crossovers) │
│ • Apex account tracking (eval/PA modes, trailing DD) │
│ • Position management (SL/TP/trailing stops) │
│ • Re-entry logic (3 bars wait, ADX > 40) │
│ • News calendar filtering (blackout periods) │
│ • State persistence (SQLite - survive restarts) │
│ • Alerting (email/SMS on critical events) │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ TRADERSPOST WEBHOOK │
│ POST https://webhooks.traderspost.io/trading/webhook/... │
│ {ticker, action, quantity, stopLoss, takeProfit} │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ BROKER (Tradovate / Apex Trader Funding) │
│ Order execution, position management, OCO brackets │
└─────────────────────────────────────────────────────────────┘
Key Features
| Feature | Implementation |
|---|---|
| Market Data | Databento API (real-time + historical) + CSV files |
| Account Modes | Eval (profit target, trailing DD) or PA (risk %, static DD) |
| Position Sizing | Fixed contracts (eval) or risk-based % (PA mode) |
| Indicator calculations | Self-contained (EMA, ATR, ADX, VWAP, signal-specific) |
| Signal detection | Edge-triggered crossovers (5 pre-built + custom) |
| Position management | Entry price, SL, TP, HWM/LWM, trailing stops |
| Re-entry logic | 3 bars wait, ADX > 40, max 10 per direction |
| News calendar | Economic event blackouts (FOMC, NFP, CPI) |
| Alerting | Email + SMS on daily loss limit, DD breach, connection loss |
| State persistence | SQLite database (survive mid-day restarts) |
| Session filtering | Configurable allowed hours (ET timezone) |
| Volume filter | Volume > EMA(volume, 20) |
| Graceful shutdown | SIGINT/SIGTERM handlers, exit positions on shutdown |
| Logging | File + console with timestamps |
| Testing | CSV backtest mode, unit tests, integration tests |
Quick Start
1. Interactive Mode
User: Create a live trading bot
Assistant: [Runs /bot:new workflow]
- Step 1: Select signal (keltner, ema_cross, vwap, supertrend, alligator)
- Step 2: Configure signal parameters
- Step 3: Set risk parameters (contracts, daily max loss)
- Step 4: Configure exits (SL, TP, trailing)
- Step 5: API credentials guidance
- Step 6: Generate bot files
2. Direct Signal
User: /bot:keltner
Assistant: [Generates Keltner bot with optimal settings]
3. Quick Mode
User: /bot:new keltner --quick
Assistant: [Uses all defaults, generates immediately]
ADX Filter Modes
All 5 modes from backtest.py supported:
| Mode | Logic | Recommended |
|---|---|---|
traditional | ADX > threshold | |
di_aligned | + DIs aligned with direction | |
di_rising | + Dominant DI rising | ✅ |
adx_rising | + ADX itself rising | |
combined | All conditions |
Exit Priority Order
- Trailing Stop (if active AND hit)
- Stop Loss (hard protective stop)
- Take Profit (profit target)
Skill References
Core Documentation
| Resource | Description |
|---|---|
| Interactive Workflow | Interactive bot generation workflow (includes account_mode) |
| Refactoring Guide | Bot refactoring and modification workflows |
| Configuration Index | Configuration index with links to topics |
| Signals Overview | Signal overview and selection guide |
| Apex Rules | Comprehensive Apex Trader Funding rules |
| Apex Compliance | Apex compliance guidelines for automated trading |
Configuration Topics
| Resource | Description |
|---|---|
| Apex Accounts | Account modes, presets, position sizing |
| Signal Parameters | All 5 signal parameters |
| ADX Modes | ADX filter modes with examples |
| Exits & Re-entry | Stop loss, take profit, trailing, re-entry |
| Risk & Filters | Risk mgmt, filters, alerts, persistence |
Guides
| Resource | Description |
|---|---|
| Eval vs PA Comparison | Eval vs PA mode comparison |
| Eval Mode Guide | Eval account detailed guide |
| PA Mode Guide | PA account detailed guide |
| Data Provider Guide | Data provider overview |
| Custom Provider Tutorial | Custom provider implementation |
| Provider Reference | Bar format, testing, best practices |
| Architecture | Architecture overview |
| Architecture Components | Component details |
| Data Flow | Bar processing, entry/exit flows |
| Deployment Guide | Deployment overview |
| VPS Setup | Server setup and installation |
| Systemd Service | Service configuration |
| Production Operations | Monitoring, security, backup |
| Economic Calendar | News calendar integration |
| Testing Guide | Unit, integration, CSV backtest testing |
| Setup Guide | Bot setup and deployment |
Signal Details
| Resource | Description |
|---|---|
| Top 5 Signals | Detailed top 5 with all parameters |
| Keltner Channel | Keltner Channel details |
| EMA Crossover | EMA Crossover details |
| Rolling VWAP | Rolling VWAP details |
| SuperTrend | SuperTrend details |
| Williams Alligator | Williams Alligator details |
Templates
| Resource | Description |
|---|---|
| Base Bot | Main bot template (with persistence, news, alerts) |
| Config | Config file template |
| Indicators | Indicators class overview |
| Core Indicators | EMA, SMA, SMMA, ATR, ADX |
| Signal Indicators | VWAP, Keltner, SuperTrend, Alligator |
| Apex Integration | Apex account integration template |
| Risk Manager | Risk manager with eval/PA support |
| Persistence | SQLite state persistence |
| News Filter | Economic calendar filtering |
| Alerting | Email/SMS alerting system |
| Data Provider | Data provider adapter interface |
| Test Suite | Test suite template |
| TradersPost Client | TradersPost webhook client |
| Tradovate Client | Tradovate WebSocket client |
Workflows
| Resource | Description |
|---|---|
| Add Feature | Add feature to existing bot |
| Remove Feature | Remove feature from bot |
| Change Indicator | Swap or modify indicators |
| Migrate to PA | Convert eval bot to PA mode |
| Custom Strategy | Build custom strategy bot |
Examples
| Resource | Description |
|---|---|
| Keltner Bot Example | Full working Keltner Channel bot example |
| Custom Data Provider | Example custom data provider adapter |
| Alert Config | Alerting configuration example |
| Indicator Tests | Unit test examples |
| Environment Template | .env file template with all required credentials |
Related Files
| File | Purpose |
|---|---|
Python/backtest.py | Reference implementation (indicator calculations, signal logic) |
Python/docs/TRADOVATE_API_GUIDE.md | TradersPost payload format, Tradovate WebSocket |
Python/STRATEGY.md | Strategy specification |
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon