size taken from monitored wallet

This commit is contained in:
2025-11-02 22:38:31 +01:00
parent d650bb5fe2
commit 5f9109c3a9
3 changed files with 261 additions and 201 deletions

View File

@ -142,7 +142,7 @@ class TradeExecutor:
# --- NEW: STATE UPDATE ON SUCCESS ---
if response.get("status") == "ok":
response_data = response.get("response", {}).get("data", {})
response_data = response.get("response", {},).get("data", {})
if response_data and "statuses" in response_data:
# Check if the order status contains an error
if "error" not in response_data["statuses"][0]:
@ -155,7 +155,9 @@ class TradeExecutor:
"side": "long" if is_buy else "short",
"open_time_utc": order['open_time_utc'],
"open_price": order['open_price'],
"amount": order['amount']
"amount": order['amount'],
# --- MODIFIED: Read leverage from the order ---
"leverage": order.get('leverage')
}
logging.info(f"Successfully opened position {position_key}. Saving state.")
elif action == "market_close":