Install
openclaw skills install crypto-executor-optimizerAutonomous optimizer skill for Wesley — reads Binance trading performance every 6 hours, analyzes win rate and strategy metrics, then safely tunes executor.p...
openclaw skills install crypto-executor-optimizerCe skill permet à Wesley d'optimiser automatiquement le bot de trading crypto-executor toutes les 6 heures.
Ce que ce skill fait :
performance_metrics.json, learned_config.json)executor.py via regex (backup → modify → validate → restart)/workspace/data/bot_config.env (chmod 600)Ce que ce skill ne fait PAS :
/workspace| Variable | Requis | Usage |
|---|---|---|
BINANCE_API_KEY | Oui (setup) | Authentification Binance — jamais modifié après setup |
BINANCE_API_SECRET | Oui (setup) | Authentification Binance — jamais modifié après setup |
TELEGRAM_BOT_TOKEN | Non | Notifications d'optimisation |
TELEGRAM_CHAT_ID | Non | Destination des notifications |
Stockage des credentials :
# Fichier créé par setup_binance_20euros.sh
/workspace/data/bot_config.env
# Permissions automatiquement appliquées
chmod 600 /workspace/data/bot_config.env
# → Lecture réservée à l'utilisateur courant uniquement
# → Jamais visible dans systemctl status ou ps aux
Ce que Wesley ne modifie JAMAIS :
BINANCE_API_KEY et BINANCE_API_SECRET — Wesley ne modifie pas ces valeurs. En revanche, lors du fallback restart, apply_optimization.sh (déclenché par Wesley) source /workspace/data/bot_config.env pour relancer executor.py avec les credentials existants.DRAWDOWN_KILL_PCT, DRAWDOWN_PAUSE_PCT — protection capitale hors portéesetup_binance_20euros.sh → Setup initial (run once)
install_cron.sh → Installe le cron Wesley (run once)
apply_optimization.sh → Appelé par Wesley toutes les 6h (automatique)
Le script de setup télécharge du code externe depuis GitHub — auditer avant d'exécuter :
# executor.py — le bot de trading principal
https://raw.githubusercontent.com/georges91560/crypto-executor/main/executor.py
# crypto_oracle.py — signaux OBI/VWAP (optionnel)
https://raw.githubusercontent.com/georges91560/crypto-sniper-oracle/main/crypto_oracle.py
Recommandation sécurité : Épingler un commit spécifique plutôt que main :
# Vérifier le commit sur GitHub, puis :
# git checkout <commit-hash>
# Sur shared hosting (Hostinger, cPanel) :
pip install websocket-client --break-system-packages
# Sur VPS/serveur standard (recommandé) :
python3 -m venv venv && source venv/bin/activate && pip install websocket-client
| Action | Pourquoi |
|---|---|
sudo systemctl restart crypto-executor | Redémarrer le bot après optimisation |
sudo systemctl stop/start crypto-executor | Contrôle du service au setup |
pkill -f executor.py | Fallback si systemd indisponible |
crontab -e | Installer le job récurrent (fallback system cron) |
Wesley est l'intelligence. Wesley lit les données de performance, analyse, décide des changements, puis exécute les scripts bash pour les appliquer.
cat /workspace/performance_metrics.json
cat /workspace/learned_config.json
cat /workspace/skills/crypto-executor/executor.py
Wesley analyse :
Win rate :
88% → peut augmenter le Kelly factor (max 0.6)
Trades par jour :
80 trades/jour → monter les seuils (qualité > quantité)
Win rate par stratégie :
92% → augmenter son allocation de 5%
Si tout est optimal (win rate > 90%, 30–60 trades/jour, toutes stratégies > 85%) : → Aucun changement. Wesley note "no changes needed" dans le log.
Wesley détermine les nouvelles valeurs pour ces paramètres :
| Paramètre | Valeur par défaut | Plage autorisée |
|---|---|---|
obi > X scalping | 0.10 | 0.06 – 0.18 |
obi > X momentum | 0.12 | 0.08 – 0.20 |
price_change > X | 0.8 | 0.4 – 2.0 |
spread_bps < X | 8 | 4 – 15 |
kelly * X factor | 0.5 | 0.3 – 0.6 |
| strategy mix scalping | 0.70 | 0.50 – 0.90 |
| strategy mix momentum | 0.25 | 0.05 – 0.40 |
| strategy mix stat_arb | 0.05 | 0.02 – 0.15 |
Wesley ne doit JAMAIS modifier :
Wesley appelle le script avec les nouvelles valeurs :
bash /workspace/skills/crypto-executor-optimizer/apply_optimization.sh \
--obi-scalping 0.11 \
--obi-momentum 0.13 \
--price-change 0.9 \
--spread-bps 9 \
--kelly-factor 0.5 \
--mix-scalping 0.72 \
--mix-momentum 0.23 \
--mix-stat-arb 0.05 \
--reason "Win rate 76%, tightening OBI thresholds"
Le script va automatiquement :
python3 -m py_compile)bash /workspace/skills/crypto-executor-optimizer/apply_optimization.sh --no-changes \
--reason "Performance optimal, no changes needed"
Ce que le script modifie dans executor.py :
Protections en place :
py_compile) avant restartLe skill installe un job récurrent via install_cron.sh :
# Schedule : toutes les 6h
0 */6 * * *
# Via OpenClaw cron (prioritaire) :
openclaw cron add --name "crypto-executor-optimizer" --cron "0 */6 * * *"
# Via system crontab (fallback si openclaw CLI indisponible) :
0 */6 * * * openclaw run --skill crypto-executor-optimizer
Désinstaller le cron :
openclaw cron remove --name crypto-executor-optimizer
# OU
crontab -e # supprimer la ligne crypto-executor-optimizer
| Fichier | Rôle |
|---|---|
/workspace/performance_metrics.json | Stats de performance du bot |
/workspace/learned_config.json | Historique des configurations précédentes |
/workspace/skills/crypto-executor/executor.py | Le bot à optimiser |
/workspace/data/bot_config.env | Credentials Binance (chmod 600) |
/workspace/logs/auto_optimize.log | Log des cycles d'optimisation |
/workspace/logs/wesley_optimizations.log | Historique des décisions de Wesley |
/workspace/skills/crypto-executor/executor_backup_*.py | Backups horodatés (5 max) |
# Voir le dernier cycle
tail -50 /workspace/logs/auto_optimize.log
# Historique des optimisations
tail -100 /workspace/logs/wesley_optimizations.log
# Backups disponibles
ls -lh /workspace/skills/crypto-executor/executor_backup_*.py
# Status du bot
sudo systemctl status crypto-executor