- Python 93.6%
- Shell 6%
- HTML 0.3%
06:25 ET pre-market Yahoo returns mostly zero-bid strikes (23 usable quotes on 2026-10-14 vs 3,034 during RTH), silently degrading the whole book to BS marks. Sparse fetches (<200 two-sided quotes) now reuse the previous chain block, marked stale=true; spy/vix always refresh. |
||
|---|---|---|
| .claude/data/sessions | ||
| agent | ||
| alembic | ||
| audits | ||
| backtest | ||
| briefs | ||
| broker | ||
| config | ||
| dashboard | ||
| data | ||
| deploy | ||
| desks | ||
| docs | ||
| journal | ||
| launchers | ||
| logs | ||
| monitoring | ||
| observability | ||
| options | ||
| prd | ||
| prompts | ||
| prompts-money-path | ||
| regime | ||
| research | ||
| risk | ||
| scripts | ||
| ship/sp-call-options | ||
| strategies | ||
| swarm | ||
| tests | ||
| .env.sample | ||
| .gitignore | ||
| alembic.ini | ||
| ARCHITECTURE.md | ||
| BRIEF_TEMPLATE.md | ||
| conftest.py | ||
| DATA_SOURCES.md | ||
| docker-compose.trading.yml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| PAPER-FIDELITY-FIXES-2026-10-13.md | ||
| prd-money-path.json | ||
| prd.json | ||
| pyproject.toml | ||
| README.md | ||
| trading.db.bak | ||
| trading.db.test_backup | ||
| TRADING_SYSTEM.md | ||
| uv.lock | ||
| WORKFLOW.md | ||
Trading Intelligence (trading-intelligence)
Self-learning quant trading system with CFA-level research.
Overview
Quantitative trading system that combines CFA-level fundamental analysis with technical indicators. Features prediction tracking, paper trading, performance scoring, and adaptive learning from historical outcomes.
Stack
- Python
Quick Start
# Clone
git clone ssh://git@192.168.183.110:2222/pook/trading-intelligence.git
cd trading-intelligence
Backtesting
Install dependencies
cd trading-intelligence
uv venv .venv
uv pip install --python .venv/bin/python yfinance
Load historical data
.venv/bin/python scripts/backtest_data.py
Downloads 5 years of daily OHLCV for 27 tickers (equities, crypto, metals, indices) into trading_intelligence.db.
Run backtests
# Single strategy
.venv/bin/python scripts/backtest_engine.py --strategy momentum --start 2023-01-01 --end 2025-12-31
.venv/bin/python scripts/backtest_engine.py --strategy mean_reversion --start 2023-01-01 --end 2025-12-31
.venv/bin/python scripts/backtest_engine.py --strategy macd --start 2023-01-01 --end 2025-12-31
.venv/bin/python scripts/backtest_engine.py --strategy random --start 2023-01-01 --end 2025-12-31
# Compare all strategies
.venv/bin/python scripts/backtest_engine.py --compare all --start 2023-01-01
# Options: --tickers SPY BTC-USD --commission 0.001 --capital 100000 --max-positions 10 --json --no-store
Available strategies
| Strategy | Description |
|---|---|
momentum |
Top-N momentum with lookback window |
mean_reversion |
RSI-based mean reversion (oversold/overbought) |
macd |
MACD histogram crossover |
random |
Random baseline (statistical control) |
Status
In Development
License
Private — All rights reserved
Dry Run Usage
# Quick 2-year run (downloads data from yfinance):
python dry_run.py --start 2024-07-01
# 5-year backtest:
python dry_run.py --start 2021-06-01 --end 2026-06-30
# Today's signals only:
python dry_run.py --today
# Use existing database instead of download:
python dry_run.py --start 2024-01-01 --use-db
# Custom capital:
python dry_run.py --start 2024-01-01 --capital 50000
Output goes to dry_run_output/:
trades.csv— every fill with strategy, side, strike, DTE, price, P&Lequity_curve.csv— daily mark-to-market equity, cash, position value, and portfolio Greeks (net_delta, net_gamma, net_theta, net_vega)state.json— resumption state
Key Metrics (5-year backtest, 2021-06 to 2026-06, hardened config)
| Metric | Strategy | SPY Buy&Hold |
|---|---|---|
| Total Return | +67.6% | +84.8% |
| Max Drawdown | -11.3% | -22.1% |
| Alpha vs SPY | -17.2% | — |
After the risk-hardening milestones (M1–M5) the strategy runs roughly flat to SPY on absolute return while cutting peak drawdown ~49% (11.3% vs 22.1%). Raw return trails buy-and-hold in this bull sample; the edge is risk-adjusted, not absolute. (The original pre-hardening baseline was -13.5% MaxDD.)
Risk Controls (hardening milestones)
- M1 — IV-rank entry gate: sell-premium entries require IV percentile ≥ 0.40
(LEAPS buys ≤ 0.60);
data/iv_rank.py. - M2 — P&L roll triggers: take profit / cut the short leg by premium P&L, not just DTE; checked before the DTE roll gate.
- M3 — Portfolio drawdown kill switch: flatten all + cooldown at 10% drawdown;
risk/portfolio_guard.py. - M4 — Greeks + delta-aware allocation: per-position/portfolio
delta/gamma/theta/vega (
risk/greeks.py); new entries blocked when net portfolio delta exceedsmax_net_delta(default 2.0 = 200 shares);strategies/allocation.py. - M5 — Fast regime override: VIX-spike / SPY-gap floors the regime ahead of the
slow classifier (
regime/fast_override.py).
Not live-tradeable. Fills use Black-Scholes pricing with a VIX-derived IV proxy — real bid/ask spread, vol skew and liquidity are absent. A real options data feed (IBKR / Polygon / Tradier) is required before deploying capital.
Adding a New Strategy
- Create
strategies/my_strategy.pyinheriting fromStrategybase class - Implement
generate_signal(ctx: MarketContext) -> Signal - Register in
dry_run.py→self.strategieslist - Defined-risk validation enforced automatically via
_validate_risk()