Lower thresholds for silent strategies:
- Funding: 3% -> 1% APR (BTC funding ~0.87%, still below) - Kalman: Z-entry 2.0 -> 1.5 sigma - Momentum: 1.2σ -> 1.0σ Bollinger bands - Mean Reversion: 1.0σ -> 0.8σ VWAP deviation
This commit is contained in:
+6
-6
@@ -132,7 +132,7 @@ def compute_signals():
|
||||
from strategies.funding_arb import get_funding_rates
|
||||
rates = get_funding_rates(use_testnet=True)
|
||||
annual_rate = rates.get("BTC", 0)
|
||||
if abs(annual_rate) > 0.03: # >3% APR threshold (testnet: lower liquidity = lower threshold)
|
||||
if abs(annual_rate) > 0.01: # >3% APR threshold (testnet: lower liquidity = lower threshold)
|
||||
sig = "SELL" if annual_rate > 0 else "BUY"
|
||||
STRATEGIES["Funding Rate Arb"]["signals"].append({
|
||||
"time":time.time(), "signal":sig,
|
||||
@@ -163,7 +163,7 @@ def compute_signals():
|
||||
if "_kalman_live" not in dir():
|
||||
globals()["_kalman_live"] = KalmanPairsTrader(
|
||||
transition_covariance=1e-4, observation_covariance=1e-2,
|
||||
z_entry=2.0, z_exit=0.5, warmup_bars=20,
|
||||
z_entry=1.5, z_exit=0.5, warmup_bars=20,
|
||||
)
|
||||
result = globals()["_kalman_live"].step(eth, btc)
|
||||
if result["signal"] != 0:
|
||||
@@ -179,8 +179,8 @@ def compute_signals():
|
||||
w = list(eth_prices)[-20:]; eth_cur = eth_prices[-1]; sma = sum(w)/len(w)
|
||||
variance = sum((p-sma)**2 for p in w)/len(w); std = math.sqrt(variance)
|
||||
if std>0:
|
||||
if eth_cur > sma+1.2*std: STRATEGIES["Momentum Breakout"]["signals"].append({"time":time.time(),"signal":"BUY","strength":(eth_cur-sma-1.2*std)/std})
|
||||
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})
|
||||
if eth_cur > sma+1.0*std: STRATEGIES["Momentum Breakout"]["signals"].append({"time":time.time(),"signal":"BUY","strength":(eth_cur-sma-1.0*std)/std})
|
||||
elif eth_cur < sma-1.0*std: STRATEGIES["Momentum Breakout"]["signals"].append({"time":time.time(),"signal":"SELL","strength":(sma-1.0*std-eth_cur)/std})
|
||||
|
||||
# Mean Reversion: VWAP on ETH
|
||||
if len(eth_prices)>=20:
|
||||
@@ -188,8 +188,8 @@ def compute_signals():
|
||||
vwap = sum(p*v for p,v in zip(w,vols))/sum(vols)
|
||||
vstd = math.sqrt(sum((p-vwap)**2 for p in w)/len(w))
|
||||
dev = (eth_mr-vwap)/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.8: STRATEGIES["Mean Reversion"]["signals"].append({"time":time.time(),"signal":"SELL","strength":dev})
|
||||
elif dev<-0.8: STRATEGIES["Mean Reversion"]["signals"].append({"time":time.time(),"signal":"BUY","strength":abs(dev)})
|
||||
|
||||
# Trim signals
|
||||
for s in STRATEGIES.values(): s["signals"] = s["signals"][-20:]
|
||||
|
||||
Reference in New Issue
Block a user