Update IDLE log to show trigger price levels
This commit is contained in:
@ -972,8 +972,16 @@ class ScalperHedger:
|
|||||||
self.last_idle_log_time = time.time()
|
self.last_idle_log_time = time.time()
|
||||||
else:
|
else:
|
||||||
if time.time() - self.last_idle_log_time > 30:
|
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
|
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.last_idle_log_time = time.time()
|
||||||
|
|
||||||
self.track_fills_and_pnl()
|
self.track_fills_and_pnl()
|
||||||
|
|||||||
@ -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`.
|
- 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.
|
- 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.
|
- 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]
|
## [2025-12-20]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user