Deep audit fixes: A-S gamma scaling + Mean Rev window
1. A-S reservation price now uses gamma*500000 scaling. Before: bash.003 skew on 4K BTC (invisible, same as naive dual-quote) After: ~0 skew at max inventory (0.05% of mid — enough to suppress one side) 2. Mean Reversion: 20-tick → 60-tick window, threshold 1.0σ → 0.5σ. 20 seconds of 1s ticks is noise, not mean-reverting. 60 seconds captures real short-term reversion dynamics. Fill attribution verified: BTC sizes differ by 50 μBTC, ETH by 0.0025 — all above matching tolerance. Orderbook null guards present — no crash on failed fetch.
This commit is contained in:
+5
-5
@@ -184,15 +184,15 @@ def compute_signals():
|
||||
elif eth_cur < sma-1.2*std: STRATEGIES["Momentum Breakout"]["signals"].append({"time":time.time(),"signal":"SELL","strength":(sma-1.2*std-eth_cur)/std})
|
||||
|
||||
# Mean Reversion: VWAP on ETH (exclude current price from VWAP)
|
||||
if len(eth_prices)>=20:
|
||||
w = list(eth_prices)[-20:]; eth_mr = eth_prices[-1]
|
||||
# VWAP on prior 19 prices, equal volume weights
|
||||
if len(eth_prices)>=60:
|
||||
w = list(eth_prices)[-60:]; eth_mr = eth_prices[-1]
|
||||
# SMA deviation on prior 59 prices (60s window captures real mean reversion)
|
||||
prior = w[:-1]
|
||||
sma = sum(prior)/len(prior)
|
||||
vstd = math.sqrt(sum((p-sma)**2 for p in prior)/len(prior))
|
||||
dev = (eth_mr-sma)/vstd if vstd>0 else 0
|
||||
if dev>1.0: STRATEGIES["Mean Reversion"]["signals"].append({"time":time.time(),"signal":"SELL","strength":dev})
|
||||
elif dev<-1.0: STRATEGIES["Mean Reversion"]["signals"].append({"time":time.time(),"signal":"BUY","strength":abs(dev)})
|
||||
if dev>0.5: STRATEGIES["Mean Reversion"]["signals"].append({"time":time.time(),"signal":"SELL","strength":dev})
|
||||
elif dev<-0.5: STRATEGIES["Mean Reversion"]["signals"].append({"time":time.time(),"signal":"BUY","strength":abs(dev)})
|
||||
|
||||
# Hurst/VPIN: feed BTC price into dollar bars
|
||||
if len(btc_prices)>=3:
|
||||
|
||||
Reference in New Issue
Block a user