|
@@ -899,6 +899,9 @@ Tap any button below for instant access to bot functions:
|
|
|
# Record the trade in stats
|
|
|
order_id = order.get('id', 'N/A')
|
|
|
actual_price = order.get('average', price) # Use actual fill price if available
|
|
|
+ if actual_price is None or actual_price <= 0:
|
|
|
+ # This should not happen due to our price validation above, but extra safety
|
|
|
+ actual_price = price
|
|
|
action_type = self.stats.record_trade_with_enhanced_tracking(symbol, 'buy', token_amount, actual_price, order_id, "bot")
|
|
|
|
|
|
# Save pending stop loss if provided
|
|
@@ -982,6 +985,9 @@ Tap any button below for instant access to bot functions:
|
|
|
# Record the trade in stats
|
|
|
order_id = order.get('id', 'N/A')
|
|
|
actual_price = order.get('average', price) # Use actual fill price if available
|
|
|
+ if actual_price is None or actual_price <= 0:
|
|
|
+ # This should not happen due to our price validation above, but extra safety
|
|
|
+ actual_price = price
|
|
|
action_type = self.stats.record_trade_with_enhanced_tracking(symbol, 'sell', token_amount, actual_price, order_id, "bot")
|
|
|
|
|
|
# Save pending stop loss if provided
|
|
@@ -1046,6 +1052,9 @@ Tap any button below for instant access to bot functions:
|
|
|
# Record the trade in stats
|
|
|
order_id = order.get('id', 'N/A')
|
|
|
actual_price = order.get('average', price) # Use actual fill price if available
|
|
|
+ if actual_price is None or actual_price <= 0:
|
|
|
+ # Fallback to ensure we have a valid price
|
|
|
+ actual_price = price
|
|
|
action_type = self.stats.record_trade_with_enhanced_tracking(symbol, exit_side, contracts, actual_price, order_id, "bot")
|
|
|
|
|
|
position_type = "LONG" if exit_side == "sell" else "SHORT"
|
|
@@ -1223,6 +1232,9 @@ Tap any button below for instant access to bot functions:
|
|
|
# Record the trade in stats
|
|
|
order_id = order.get('id', 'N/A')
|
|
|
actual_price = order.get('average', price) # Use actual fill price if available
|
|
|
+ if actual_price is None or actual_price <= 0:
|
|
|
+ # Fallback to ensure we have a valid price
|
|
|
+ actual_price = price
|
|
|
action_type = self.stats.record_trade_with_enhanced_tracking(symbol, exit_side, contracts, actual_price, order_id, "bot")
|
|
|
|
|
|
position_type = "LONG" if exit_side == "sell" else "SHORT"
|