Update IDLE log to show trigger price levels

This commit is contained in:
2025-12-21 22:56:48 +01:00
parent 1a12fde839
commit e5151d9d66
2 changed files with 11 additions and 1 deletions

View File

@ -972,8 +972,16 @@ class ScalperHedger:
self.last_idle_log_time = time.time()
else:
if time.time() - self.last_idle_log_time > 30:
# Calculate approximate trigger prices (Linear Approximation)
# G = 0.5 * L * P^-1.5
gamma = (Decimal("0.5") * self.strategy.L * (price ** Decimal("-1.5")))
# Price where Diff reaches -threshold (BUY)
p_buy = price + (rebalance_threshold + calc['diff']) / gamma
# Price where Diff reaches +threshold (SELL)
p_sell = price - (rebalance_threshold - calc['diff']) / gamma
net_pnl = self.accumulated_pnl - self.accumulated_fees
logger.info(f"[IDLE] Px: {price:.2f} | Diff: {diff_abs:.4f} < {rebalance_threshold:.4f} (Vol: {vol_pct*100:.3f}% x{vol_multiplier:.1f} | Thresh: {final_threshold_pct*100:.1f}%) | TotPnL: {net_pnl:.2f}")
logger.info(f"[IDLE] Px: {price:.2f} | B: {p_buy:.1f} / S: {p_sell:.1f} (Vol: {vol_pct*100:.3f}% x{vol_multiplier:.1f} | Thresh: {final_threshold_pct*100:.1f}%) | TotPnL: {net_pnl:.2f}")
self.last_idle_log_time = time.time()
self.track_fills_and_pnl()