Update trading configuration to allow full fund utilization and adjust base size calculation in strategy
- Changed `max_position_usdt` to -1.0 to indicate that all available funds should be used if the value is less than or equal to zero. - Modified the base size calculation in `LiveRegimeStrategy` to accommodate the new logic for `max_position_usdt`, ensuring it uses all available funds when applicable.
This commit is contained in:
@@ -65,7 +65,7 @@ class TradingConfig:
|
||||
candles_to_fetch: int = 500 # Enough for feature calculation
|
||||
|
||||
# Position sizing
|
||||
max_position_usdt: float = 1000.0 # Max position size in USDT
|
||||
max_position_usdt: float = -1.0 # Max position size in USDT. If <= 0, use all available funds
|
||||
min_position_usdt: float = 10.0 # Min position size in USDT
|
||||
leverage: int = 1 # Leverage (1x = no leverage)
|
||||
margin_mode: str = "cross" # "cross" or "isolated"
|
||||
|
||||
@@ -241,8 +241,11 @@ class LiveRegimeStrategy:
|
||||
"""
|
||||
prob = signal.get('probability', 0.5)
|
||||
|
||||
# Base size is max_position_usdt
|
||||
base_size = min(available_usdt, self.config.max_position_usdt)
|
||||
# Base size: if max_position_usdt <= 0, use all available funds
|
||||
if self.config.max_position_usdt <= 0:
|
||||
base_size = available_usdt
|
||||
else:
|
||||
base_size = min(available_usdt, self.config.max_position_usdt)
|
||||
|
||||
# Scale by probability (1.0x at 0.5 prob, up to 1.6x at 0.8 prob)
|
||||
scale = 1.0 + (prob - 0.5) * 2.0
|
||||
|
||||
@@ -95,7 +95,7 @@ class LiveTradingBot:
|
||||
print(f" Trading Pair: {self.trading_config.eth_symbol}")
|
||||
print(f" Context Pair: {self.trading_config.btc_symbol}")
|
||||
print(f" Timeframe: {self.trading_config.timeframe}")
|
||||
print(f" Max Position: ${self.trading_config.max_position_usdt}")
|
||||
print(f" Max Position: ${self.trading_config.max_position_usdt if self.trading_config.max_position_usdt > 0 else 'All available'}")
|
||||
print(f" Leverage: {self.trading_config.leverage}x")
|
||||
print(f" Stop Loss: {self.trading_config.stop_loss_pct * 100:.1f}%")
|
||||
print(f" Take Profit: {self.trading_config.take_profit_pct * 100:.1f}%")
|
||||
|
||||
Reference in New Issue
Block a user