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()

View File

@ -9,6 +9,8 @@ All notable changes to this project will be documented in this file.
- Introduced `BASE_REBALANCE_THRESHOLD_PCT` configuration flag in `clp_hedger.py`.
- Increased base rebalance threshold from **0.05 (5%)** to **0.08 (8%)** to reduce "churn" (excessive trading) during low volatility/sideways markets.
- This change aims to improve net profitability by ensuring that rebalancing fees are only paid when the delta imbalance is statistically significant.
- **Logging Improvements**:
- Updated `[IDLE]` log format to show estimated **BUY (B)** and **SELL (S)** trigger price levels instead of raw delta difference. This provides better visual feedback on how far the price is from the next rebalance.
## [2025-12-20]