From e5151d9d66cfc4ad881adb5dff0f6245aad69f69 Mon Sep 17 00:00:00 2001 From: DiTus Date: Sun, 21 Dec 2025 22:56:48 +0100 Subject: [PATCH] Update IDLE log to show trigger price levels --- clp_hedger.py | 10 +++++++++- doc/CHANGELOG.md | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/clp_hedger.py b/clp_hedger.py index 3efde2c..f08367d 100644 --- a/clp_hedger.py +++ b/clp_hedger.py @@ -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() diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index b0d7ca7..2629bd7 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -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]