89 lines
2.1 KiB
Markdown
89 lines
2.1 KiB
Markdown
# GP FX Trading Strategy
|
||
|
||
An autonomous Genetic Programming (GP) system that evolves high win-rate FX trading strategies using multi-pair OHLCV data, vectorbt backtesting, and an AI advisor loop (Kimi-K2.5 / deepseek-r1).
|
||
|
||
## Results
|
||
|
||
### Phase 1 — Best Round
|
||
| Metric | Value |
|
||
|--------|-------|
|
||
| Win Rate | **98.71%** |
|
||
| Sharpe Ratio | 9.635 |
|
||
| Total Return | +21.29% |
|
||
| Total Trades | 545 |
|
||
| Test Period | Nov 2025 – Mar 2026 |
|
||
|
||
### Phase 2 — In Progress
|
||
| Rule | Value |
|
||
|------|-------|
|
||
| Position size | $1,000/trade (training) |
|
||
| Stop loss | 1x ATR |
|
||
| Trail trigger | 3x ATR |
|
||
| Trail distance | 15% behind current price |
|
||
| Max live trades | 3 × $300 = $900 exposure |
|
||
|
||
## Quick Start (New Machine)
|
||
```bash
|
||
# 1. Clone
|
||
git clone https://github.com/Anwar-Projects/gp-fx-strategy.git
|
||
cd gp-fx-strategy
|
||
|
||
# 2. Setup environment
|
||
make setup
|
||
|
||
# 3. Download and prepare data
|
||
make data
|
||
|
||
# 4. Run Phase 2 training
|
||
make train
|
||
|
||
# 5. Monitor
|
||
make monitor
|
||
```
|
||
|
||
## Architecture
|
||
```
|
||
HistData.com (1M bars)
|
||
↓
|
||
scripts/resample_to_5m.py
|
||
↓
|
||
data/EURUSD_5M.csv
|
||
data/GBPUSD_5M.csv
|
||
data/USDJPY_5M.csv
|
||
↓
|
||
src/run_until_good_phase2.py ←── loops until 80% win rate
|
||
↓
|
||
src/gp_strategy_progress_vectorbt_phase2.py
|
||
↓ ↓
|
||
DEAP GP Evolution vectorbt simulation
|
||
(34 workers) (SL + trailing stop)
|
||
↓
|
||
best_individual.dill
|
||
↓
|
||
src/kimi_advisor_phase2.py ←── Kimi-K2.5 / deepseek-r1
|
||
↓
|
||
Fitness function tuned
|
||
↓
|
||
Telegram notification when target hit
|
||
```
|
||
|
||
## Directory Structure
|
||
```
|
||
gp-fx-strategy/
|
||
├── data/ # Downloaded + resampled OHLCV data
|
||
├── docs/ # Documentation and notes
|
||
├── logs/ # Training logs and summaries
|
||
├── models/ # Saved GP strategies (.dill files)
|
||
├── scripts/ # Setup and data download helpers
|
||
│ ├── download_data.sh
|
||
│ ├── resample_to_5m.py
|
||
│ └── setup.sh
|
||
└── src/ # Training + inference source code
|
||
├── gp_strategy_progress_vectorbt_phase2.py
|
||
├── run_until_good_phase2.py
|
||
└── kimi_advisor_phase2.py
|
||
```
|
||
|
||
## Credits
|
||
Developed as part of autonomous trading research.
|