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:
@@ -87,6 +87,13 @@ STRATEGIES = {
|
||||
"signals": [], "type": "reversal", "size":0.022500, "fee_model": "taker",
|
||||
"description": "VWAP deviation — buys below VWAP, sells above. Oscillates around fair value.",
|
||||
},
|
||||
"Hurst VPIN": {
|
||||
"allocation": 10000.0, "instrument": "BTC", "pnl": 0.0,
|
||||
"trades_today": 0, "wins": 0, "win_rate": 0.0, "status": "idle",
|
||||
"position": 0.0, "entry_price": 0.0, "fee_paid": 0.0,
|
||||
"signals": [], "type": "momentum", "size": 0.002, "fee_model": "taker",
|
||||
"description": "Hurst exponent regime filter + VPIN informed flow. Enters when both align trending + high flow imbalance.",
|
||||
},
|
||||
"Hawkes OFI (new)": {
|
||||
"allocation": 10000.0, "instrument": "BTC", "pnl": 0.0,
|
||||
"trades_today": 0, "wins": 0, "win_rate": 0.0, "status": "idle",
|
||||
@@ -228,6 +235,24 @@ def compute_signals():
|
||||
|
||||
# Order Book Imbalance — MOVED to main loop (uses real L2 bid/ask volume)
|
||||
|
||||
# Hurst/VPIN — feed BTC price into dollar bars
|
||||
if len(btc_prices) >= 3:
|
||||
try:
|
||||
from strategies.hurst_vpin_live import HurstVPINLive
|
||||
if "_hv_live" not in dir():
|
||||
globals()["_hv_live"] = HurstVPINLive(
|
||||
threshold=50000.0, hurst_entry=0.55, vpin_threshold=0.25
|
||||
)
|
||||
hv_signal = globals()["_hv_live"].feed_price(btc)
|
||||
if hv_signal:
|
||||
STRATEGIES["Hurst VPIN"]["signals"].append({
|
||||
"time": time.time(),
|
||||
"signal": hv_signal["signal"],
|
||||
"strength": hv_signal["hurst"],
|
||||
"reason": f"H={hv_signal['hurst']:.2f}_V={hv_signal['vpin']:.2f}"
|
||||
})
|
||||
except: pass
|
||||
|
||||
# Iceberg
|
||||
if len(btc_prices) >= 10:
|
||||
up = sum(1 for i in range(-9,0) if btc_prices[i+1] > btc_prices[i])
|
||||
|
||||
Reference in New Issue
Block a user