MidasBot: bot trading crypto IA + stratégies Ichimoku validées
- Infra: Freqtrade (futures dry-run) + Redis + dashboard + Docker Compose - Couche IA: ai_analyzer (Claude via abonnement, MCP TradingView, backfill biais) - Stratégies: SampleStrategy, AiBiasStrategy, IchimokuLS (long/short, validée train/test + données vierges + walk-forward), MTFIchimoku, variantes hyperopt - Arbitrage CEX (dry-run), backtesting, walk-forward, volatility targeting - IchimokuLS en dry-run live (config_live.json) Claude-Session: https://claude.ai/code/session_01VHETcFacdnDhQzthLpdYFR
This commit is contained in:
31
scripts/com.midasbot.analyzer.plist
Normal file
31
scripts/com.midasbot.analyzer.plist
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.midasbot.analyzer</string>
|
||||
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/bin/bash</string>
|
||||
<string>/Users/jerem/Documents/projects/perso/MidasBot/scripts/run_analyzer.sh</string>
|
||||
</array>
|
||||
|
||||
<!-- Toutes les heures (3600 s). Premier lancement immédiat au chargement. -->
|
||||
<key>StartInterval</key>
|
||||
<integer>3600</integer>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
|
||||
<key>ThrottleInterval</key>
|
||||
<integer>60</integer>
|
||||
|
||||
<key>StandardOutPath</key>
|
||||
<string>/Users/jerem/Documents/projects/perso/MidasBot/logs/analyzer.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/Users/jerem/Documents/projects/perso/MidasBot/logs/analyzer.log</string>
|
||||
|
||||
<key>ProcessType</key>
|
||||
<string>Background</string>
|
||||
</dict>
|
||||
</plist>
|
||||
21
scripts/run_analyzer.sh
Executable file
21
scripts/run_analyzer.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# MidasBot — exécute UN cycle de l'analyzer IA (sur l'hôte, auth abonnement Claude).
|
||||
# Appelé par launchd (horaire). Parle au Redis dockerisé (port hôte 6380).
|
||||
set -eo pipefail
|
||||
|
||||
PROJECT="/Users/jerem/Documents/projects/perso/MidasBot"
|
||||
|
||||
# PATH explicite : claude + node + outils système (launchd a un PATH minimal).
|
||||
export PATH="/Users/jerem/.local/bin:/Users/jerem/.nvm/versions/node/v24.15.0/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
||||
|
||||
# IMPORTANT : pas de clé API (on veut l'abonnement, pas la facturation au token).
|
||||
unset ANTHROPIC_API_KEY || true
|
||||
|
||||
export REDIS_URL="redis://localhost:6380/0"
|
||||
export ANALYZER_PAIRS="BTC/USDT,ETH/USDT,SOL/USDT,BNB/USDT"
|
||||
export ANALYZER_TIMEFRAME="1h"
|
||||
export ANALYZER_MODEL="claude-sonnet-4-6"
|
||||
export ANALYZER_HISTORY_DIR="$PROJECT/freqtrade/user_data/ai_bias_history"
|
||||
|
||||
cd "$PROJECT/ai_analyzer"
|
||||
exec "$PROJECT/.venv/bin/python" analyzer.py --once
|
||||
32
scripts/walkforward.sh
Normal file
32
scripts/walkforward.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Walk-forward IchimokuHyper : pour chaque fold, hyperopt sur train -> backtest OOS sur test.
|
||||
set -eo pipefail
|
||||
cd /Users/jerem/Documents/projects/perso/MidasBot
|
||||
CFG=/freqtrade/user_data/config_ich.json
|
||||
DC="docker compose run --rm --no-deps freqtrade"
|
||||
|
||||
# Paires train|test (train 6 mois glissant, test 2 mois OOS), 2024-06 -> 2026-06
|
||||
FOLDS=(
|
||||
"20240601-20241201|20241201-20250201"
|
||||
"20240801-20250201|20250201-20250401"
|
||||
"20241001-20250401|20250401-20250601"
|
||||
"20241201-20250601|20250601-20250801"
|
||||
"20250201-20250801|20250801-20251001"
|
||||
"20250401-20251001|20251001-20251201"
|
||||
"20250601-20251201|20251201-20260201"
|
||||
"20250801-20260201|20260201-20260401"
|
||||
"20251001-20260401|20260401-20260623"
|
||||
)
|
||||
|
||||
echo "FOLD | TEST_PERIOD | OOS_GAIN%"
|
||||
for f in "${FOLDS[@]}"; do
|
||||
tr="${f%%|*}"; te="${f##*|}"
|
||||
$DC hyperopt --config $CFG --strategy IchimokuHyper \
|
||||
--hyperopt-loss ProfitDrawDownHyperOptLoss --spaces buy roi stoploss trailing \
|
||||
--timeframe 1h --timerange "$tr" --epochs 80 -j 4 > /tmp/wf_ho.log 2>&1
|
||||
g=$($DC backtesting --config $CFG --strategy IchimokuHyper \
|
||||
--timeframe 1h --timerange "$te" 2>&1 \
|
||||
| grep -iE 'Total profit %' | head -1 | grep -oE '[-0-9.]+%' | head -1)
|
||||
echo "$tr | $te | $g"
|
||||
done
|
||||
echo "WALKFORWARD_DONE"
|
||||
31
scripts/walkforward_chop.sh
Normal file
31
scripts/walkforward_chop.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Walk-forward IchimokuChop (avec filtre anti-chop) — mêmes folds que le baseline.
|
||||
set -eo pipefail
|
||||
cd /Users/jerem/Documents/projects/perso/MidasBot
|
||||
CFG=/freqtrade/user_data/config_ich.json
|
||||
DC="docker compose run --rm --no-deps freqtrade"
|
||||
|
||||
FOLDS=(
|
||||
"20240601-20241201|20241201-20250201"
|
||||
"20240801-20250201|20250201-20250401"
|
||||
"20241001-20250401|20250401-20250601"
|
||||
"20241201-20250601|20250601-20250801"
|
||||
"20250201-20250801|20250801-20251001"
|
||||
"20250401-20251001|20251001-20251201"
|
||||
"20250601-20251201|20251201-20260201"
|
||||
"20250801-20260201|20260201-20260401"
|
||||
"20251001-20260401|20260401-20260623"
|
||||
)
|
||||
|
||||
echo "FOLD | TEST_PERIOD | OOS_GAIN%"
|
||||
for f in "${FOLDS[@]}"; do
|
||||
tr="${f%%|*}"; te="${f##*|}"
|
||||
$DC hyperopt --config $CFG --strategy IchimokuChop \
|
||||
--hyperopt-loss ProfitDrawDownHyperOptLoss --spaces buy roi stoploss trailing \
|
||||
--timeframe 1h --timerange "$tr" --epochs 80 -j 4 > /tmp/wf_chop_ho.log 2>&1
|
||||
g=$($DC backtesting --config $CFG --strategy IchimokuChop \
|
||||
--timeframe 1h --timerange "$te" 2>&1 \
|
||||
| grep -iE 'Total profit %' | head -1 | grep -oE '[-0-9.]+%' | head -1)
|
||||
echo "$tr | $te | $g"
|
||||
done
|
||||
echo "WALKFORWARD_CHOP_DONE"
|
||||
0
scripts/walkforward_gen.sh
Executable file
0
scripts/walkforward_gen.sh
Executable file
31
scripts/walkforward_vol.sh
Normal file
31
scripts/walkforward_vol.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
# Walk-forward IchimokuHyperVol (volatility targeting) — mêmes folds que le baseline.
|
||||
set -eo pipefail
|
||||
cd /Users/jerem/Documents/projects/perso/MidasBot
|
||||
CFG=/freqtrade/user_data/config_ich.json
|
||||
DC="docker compose run --rm --no-deps freqtrade"
|
||||
|
||||
FOLDS=(
|
||||
"20240601-20241201|20241201-20250201"
|
||||
"20240801-20250201|20250201-20250401"
|
||||
"20241001-20250401|20250401-20250601"
|
||||
"20241201-20250601|20250601-20250801"
|
||||
"20250201-20250801|20250801-20251001"
|
||||
"20250401-20251001|20251001-20251201"
|
||||
"20250601-20251201|20251201-20260201"
|
||||
"20250801-20260201|20260201-20260401"
|
||||
"20251001-20260401|20260401-20260623"
|
||||
)
|
||||
|
||||
echo "FOLD | TEST_PERIOD | OOS_GAIN%"
|
||||
for f in "${FOLDS[@]}"; do
|
||||
tr="${f%%|*}"; te="${f##*|}"
|
||||
$DC hyperopt --config $CFG --strategy IchimokuHyperVol \
|
||||
--hyperopt-loss ProfitDrawDownHyperOptLoss --spaces buy roi stoploss trailing \
|
||||
--timeframe 1h --timerange "$tr" --epochs 80 -j 4 > /tmp/wf_vol_ho.log 2>&1
|
||||
g=$($DC backtesting --config $CFG --strategy IchimokuHyperVol \
|
||||
--timeframe 1h --timerange "$te" 2>&1 \
|
||||
| grep -iE 'Total profit %' | head -1 | grep -oE '[-0-9.]+%' | head -1)
|
||||
echo "$tr | $te | $g"
|
||||
done
|
||||
echo "WALKFORWARD_VOL_DONE"
|
||||
Reference in New Issue
Block a user