fix: Critical error fixes - division by zero and mock data removal
- Add zero price validation in trading_executor to prevent division by zero - Remove mock prediction fallback - enforce NO SYNTHETIC DATA policy - System now fails gracefully without predictions rather than using fake data Fixes division by zero errors when executing trades Enforces REAL_MARKET_DATA_POLICY.md compliance
This commit is contained in:
@@ -84,4 +84,7 @@ use existing checkpoint manager if it;s not too bloated as well. otherwise re-im
|
|||||||
we should load the models in a way that we do a back propagation and other model specificic training at realtime as training examples emerge from the realtime data we process. we will save only the best examples (the realtime data dumps we feed to the models) so we can cold start other models if we change the architecture. if it's not working, perform a cleanup of all traininn and trainer code to make it easer to work withm to streamline latest changes and to simplify and refactor it
|
we should load the models in a way that we do a back propagation and other model specificic training at realtime as training examples emerge from the realtime data we process. we will save only the best examples (the realtime data dumps we feed to the models) so we can cold start other models if we change the architecture. if it's not working, perform a cleanup of all traininn and trainer code to make it easer to work withm to streamline latest changes and to simplify and refactor it
|
||||||
|
|
||||||
|
|
||||||
let's also work on the transformer model - we will add a candlestick tokenizer that will use 8 dimentional vectors to represent candlesticks: 5 dim for OHLCV data, 1 for the timestamp, timeframe and symbol
|
let's also work on the transformer model - we will add a candlestick tokenizer that will use 8 dimentional vectors to represent candlesticks: 5 dim for OHLCV data, 1 for the timestamp, timeframe and symbol
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -335,6 +335,12 @@ class TradingExecutor:
|
|||||||
|
|
||||||
# Calculate position size
|
# Calculate position size
|
||||||
position_value = self._calculate_position_size(confidence, current_price)
|
position_value = self._calculate_position_size(confidence, current_price)
|
||||||
|
|
||||||
|
# CRITICAL: Check for zero price to prevent division by zero
|
||||||
|
if current_price <= 0:
|
||||||
|
logger.error(f"Invalid price {current_price} for {symbol} - cannot calculate quantity")
|
||||||
|
return False
|
||||||
|
|
||||||
quantity = position_value / current_price
|
quantity = position_value / current_price
|
||||||
|
|
||||||
logger.info(f"Executing BUY: {quantity:.6f} {symbol} at ${current_price:.2f} "
|
logger.info(f"Executing BUY: {quantity:.6f} {symbol} at ${current_price:.2f} "
|
||||||
@@ -570,6 +576,12 @@ class TradingExecutor:
|
|||||||
|
|
||||||
# Calculate position size
|
# Calculate position size
|
||||||
position_value = self._calculate_position_size(confidence, current_price)
|
position_value = self._calculate_position_size(confidence, current_price)
|
||||||
|
|
||||||
|
# CRITICAL: Check for zero price to prevent division by zero
|
||||||
|
if current_price <= 0:
|
||||||
|
logger.error(f"Invalid price {current_price} for {symbol} - cannot calculate quantity")
|
||||||
|
return False
|
||||||
|
|
||||||
quantity = position_value / current_price
|
quantity = position_value / current_price
|
||||||
|
|
||||||
logger.info(f"Executing SHORT: {quantity:.6f} {symbol} at ${current_price:.2f} "
|
logger.info(f"Executing SHORT: {quantity:.6f} {symbol} at ${current_price:.2f} "
|
||||||
|
|||||||
@@ -6965,7 +6965,9 @@ class CleanTradingDashboard:
|
|||||||
logger.info("Enhanced training system initialized for model predictions")
|
logger.info("Enhanced training system initialized for model predictions")
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.warning("Enhanced training system not available - using mock predictions")
|
# CRITICAL: NO MOCK/SYNTHETIC DATA - System runs without predictions if not available
|
||||||
|
logger.error("CRITICAL: Enhanced training system not available - predictions disabled. NEVER use mock data.")
|
||||||
|
logger.error("See: reports/REAL_MARKET_DATA_POLICY.md")
|
||||||
self.training_system = None
|
self.training_system = None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error initializing enhanced training system: {e}")
|
logger.error(f"Error initializing enhanced training system: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user