feat: proper Grid MM, Composite MM, Hurst/VPIN, Iceberg, A-S strategies
New strategies (strategies/nt/):
- GridMMNT: symmetric limit order grid around mid-price, captures spread from
oscillation. Simulates fills from candle high/low. Rebuilds grid every 20 bars.
- CompositeMMNT: weighted ensemble of OBI (30%) + A-S inventory skew (40%) +
Hurst/VPIN (30%). Votes: +1 long, -1 short, 0 neutral. Entry |score| > 0.5.
- IcebergNT: volume spike detection for whale accumulation. Dual-mode:
candle proxy (volume > avg*2.5, >= 3 consecutive same-direction) and
L2 wall detection (single level > avg*3). Exit on stop-loss/time/spike-fade.
Fixed strategies:
- Hurst/VPIN VBT: added proper VPIN proxy from candle volume (buy_vol when close
> open, sell_vol when close < open). 50-bar rolling VPIN window. Signal:
H>0.55 AND VPIN>0.25 AND |direction|>0.05. Exit: H<0.45 or direction flips.
- Hurst/VPIN paper trader: added HurstVPINLive integration (was missing entirely)
- A-S VBT: replaced placeholder spread filter with proper A-S simulation using
reservation price formula (mid - q*gamma*sigma^2*tau), inventory tracking
- A-S NT formula: fixed to standard: mid - q*gamma*sigma^2*tau (was scaled by
notional and gamma_scale improperly)
- Iceberg VBT: new volume spike detection replacing the old trend proxy
Registry: all 7 strategies now ✅ (pairs, hurst_vpin, as_mm, obi, grid_mm,
composite_mm, iceberg)
VBT backtest results (500 BTC 1h bars):
pairs: -2.81% 13 trades 38% win
hurst_vpin: -0.77% 1 trade (VPIN now active, very selective)
as_mm: -16.38% 73 trades 29% win
obi: -7.19% 15 trades 7% win
grid_mm: -4.79% 22 trades 33% win
iceberg: 0 trades (threshold strict for 1h BTC data)
This commit is contained in:
@@ -112,10 +112,8 @@ class ASMarketMakingNT(BaseHlStrategy):
|
||||
|
||||
# Reservation price from A-S formula
|
||||
q_notional = self._inventory * mid
|
||||
gamma_eff = self._gamma * self._gamma_scale
|
||||
tau_rem = max(self._tau - t, 0.01)
|
||||
sigma_sq = max(self._sigma ** 2, 0.000001)
|
||||
reservation = mid - q_notional * gamma_eff * sigma_sq * tau_rem
|
||||
reservation = mid - self._inventory * self._gamma * sigma_sq * self._tau
|
||||
|
||||
# Quote sides based on reservation vs market
|
||||
quote_bid = reservation >= best_bid or abs(self._inventory) < self._max_inventory * 0.1
|
||||
|
||||
Reference in New Issue
Block a user