Skip to content

Commit 446c460

Browse files
author
Franz VETTER
committed
🔥 v1.7.4: CORRECTION MAJEURE OCO - Extraction IDs via orderReports
✅ CORRECTIONS PRINCIPALES: - Fix extraction profit/stop order IDs depuis orderReports (au lieu de orders) - Gestion complète des fills multiples dans execute_buy_order() - Amélioration robustesse surveillance OCO avec vérification directe - Optimisation cache RSI et gestion erreurs 🎯 IMPACT: - Les ordres OCO auront enfin les bons IDs profit/stop en base - Calculs de commission et prix moyens exacts sur achats multi-fills - Surveillance OCO plus fiable avec détection d'exécution améliorée - Performance optimisée sur Raspberry Pi Zero W2 ⚡ TECHNIQUE: - TradingEngine: orderReports vs orders pour extraction types OCO - BinanceClient: gestion retry et cache intelligent - Database: transactions bulletproof avec gestion doublons - Config: paramètres avancés future_transfer et sécurités 🛡️ SÉCURITÉ: - Cooldown persistant entre exécutions via DB - Limites journalières globales respectées - Validation NOTIONAL et LOT_SIZE dynamiques - Protection contre sur-trading
1 parent 2ec494d commit 446c460

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/trading_engine.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -610,25 +610,25 @@ def execute_sell_order_with_stop_loss(self, symbol: str, bought_quantity: float,
610610

611611
self.logger.info(f"✅ ORDRE OCO PLACÉ {symbol}")
612612

613-
# 🔥 EXTRACTION IDS AVEC LOGIQUE DIAGNOSTIQUE CORRECTE
613+
# 🔥 EXTRACTION IDS CORRIGÉE - UTILISER orderReports !
614614
profit_order_id = None
615615
stop_order_id = None
616616
oco_order_list_id = oco_order.get('orderListId', '')
617617

618618
self.logger.debug(f"🔍 OCO Response: orderListId={oco_order_list_id}")
619619

620-
orders = oco_order.get('orders', [])
621-
self.logger.debug(f"🔍 Orders in OCO: {len(orders)}")
620+
# 🎯 CLEF DU SUCCÈS: orderReports contient les types !
621+
order_reports = oco_order.get('orderReports', [])
622+
self.logger.debug(f"🔍 OrderReports in OCO: {len(order_reports)}")
622623

623-
# 🎯 LOGIQUE BASÉE SUR VOTRE DIAGNOSTIC RÉUSSI
624-
for i, order in enumerate(orders):
624+
for i, order in enumerate(order_reports):
625625
order_id = order.get('orderId')
626626
order_type = order.get('type')
627627
order_side = order.get('side', '')
628628

629-
self.logger.debug(f" Order {i+1}: ID={order_id}, Type={order_type}, Side={order_side}")
629+
self.logger.debug(f" OrderReport {i+1}: ID={order_id}, Type={order_type}, Side={order_side}")
630630

631-
# ✅ LOGIQUE EXACTE IDENTIFIÉE PAR VOTRE DIAGNOSTIC
631+
# ✅ LOGIQUE EXACTE BASÉE SUR VOTRE TEST RÉUSSI
632632
if order_type == 'LIMIT_MAKER':
633633
profit_order_id = order_id
634634
self.logger.info(f" 📈 Limite profit: {profit_order_id}")
@@ -640,9 +640,9 @@ def execute_sell_order_with_stop_loss(self, symbol: str, bought_quantity: float,
640640

641641
# Vérification finale
642642
if not profit_order_id:
643-
self.logger.warning(f"⚠️ PROFIT_ORDER_ID non trouvé dans la réponse OCO !")
643+
self.logger.warning(f"⚠️ PROFIT_ORDER_ID non trouvé dans orderReports !")
644644
if not stop_order_id:
645-
self.logger.warning(f"⚠️ STOP_ORDER_ID non trouvé dans la réponse OCO !")
645+
self.logger.warning(f"⚠️ STOP_ORDER_ID non trouvé dans orderReports !")
646646

647647
# 🔥 INSERTION EN BASE BULLETPROOF
648648
try:

0 commit comments

Comments
 (0)