fix: Add tuple unpacking for check_existing_positions return value

Fixed TypeError caused by missing tuple unpacking:
- check_existing_positions() returns (has_position, position_info)
- Was accessing as dict directly → TypeError
- Now properly unpacks: has_position, position_info = check_existing_positions()

Fixed in:
- activate_enhanced_scoring.py
- Notebook cells 15, 27, 84, 89

Error resolved: TypeError: tuple indices must be integers or slices, not str
This commit is contained in:
2026-01-21 13:37:58 +01:00
parent ccbc5f8d06
commit 1007b904fa
3 changed files with 7 additions and 7 deletions
@@ -579,7 +579,7 @@
"\n",
"def get_position_summary(symbol=\"XAUUSD\", strategy_name=\"TradingBot_V1.6\"):\n",
" \"\"\"Position-Zusammenfassung\"\"\"\n",
" has_position, position_info = check_existing_positions(symbol, strategy_name)\n",
" has_position, has_position, position_info = check_existing_positions(symbol, strategy_name)\n",
" \n",
" print(f\"\\n📊 POSITION SUMMARY für {symbol} (V1.6 Adaptive Complete)\")\n",
" print(\"=\" * 60)\n",
@@ -608,7 +608,7 @@
" ✅ KORRIGIERT: Schließt bestehende Positionen (optional)\n",
" Diese Funktion fehlte in der ursprünglichen V1.6!\n",
" \"\"\"\n",
" has_position, position_info = check_existing_positions(symbol, strategy_name)\n",
" has_position, has_position, position_info = check_existing_positions(symbol, strategy_name)\n",
" \n",
" if not has_position:\n",
" print(\"✅ Keine Positionen zum Schließen\")\n",
@@ -1195,7 +1195,7 @@
" \n",
" # SCHRITT 1: POSITION CHECK\n",
" print(f\"\\n🔍 POSITION CHECK für {symbol} (V1.6 Adaptive Complete)\")\n",
" has_position, position_info = check_existing_positions(symbol, strategy_name)\n",
" has_position, has_position, position_info = check_existing_positions(symbol, strategy_name)\n",
" \n",
" if has_position and position_info['count'] >= max_positions:\n",
" if debug:\n",
@@ -3281,7 +3281,7 @@
" try:\n",
" # SCHRITT 1: Position Check (wie vorher)\n",
" max_positions = TRADING_CONFIG['risk']['max_positions']\n",
" position_info = check_existing_positions(symbol)\n",
" has_position, position_info = check_existing_positions(symbol)\n",
"\n",
" if position_info['count'] >= max_positions:\n",
" if debug:\n",
@@ -3545,7 +3545,7 @@
" try:\n",
" # SCHRITT 1: Position Check (wie vorher)\n",
" max_positions = TRADING_CONFIG['risk']['max_positions']\n",
" position_info = check_existing_positions(symbol)\n",
" has_position, position_info = check_existing_positions(symbol)\n",
"\n",
" if position_info['count'] >= max_positions:\n",
" if debug:\n",