merge: resolve conflicts, keep local framework changes
This commit is contained in:
+18
-16
@@ -42,49 +42,49 @@ STRATEGIES = {
|
||||
"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": "reversal", "size": 0.002, "fee_model": "taker",
|
||||
"signals": [], "type": "reversal", "size":0.000800, "fee_model": "taker",
|
||||
"description": "L2 bid/ask volume skew — buys when bids dominate, sells when asks dominate. Mean-reverting at volume extremes.",
|
||||
},
|
||||
"Iceberg Detection": {
|
||||
"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.001, "fee_model": "taker",
|
||||
"signals": [], "type": "momentum", "size":0.000850, "fee_model": "taker",
|
||||
"description": "Detects whale accumulation (many small buys over time). Follows the smart money flow.",
|
||||
},
|
||||
"Funding Rate Arb": {
|
||||
"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": "carry", "size": 0.005, "fee_model": "taker",
|
||||
"signals": [], "type": "carry", "size":0.000900, "fee_model": "taker",
|
||||
"description": "Delta-neutral carry trade — shorts perp when funding rate is high, collects hourly payments.",
|
||||
},
|
||||
"Pairs Trading": {
|
||||
"allocation": 10000.0, "instrument": "ETH", "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": "stat_arb", "size": 0.05, "fee_model": "taker",
|
||||
"signals": [], "type": "stat_arb", "size":0.027500, "fee_model": "taker",
|
||||
"description": "BTC/ETH spread mean reversion — trades when Z-score exceeds 1.5 sigma. Pairs converge back to equilibrium.",
|
||||
},
|
||||
"Avellaneda-Stoikov": {
|
||||
"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": "market_making", "size": 0.001, "fee_model": "maker",
|
||||
"signals": [], "type": "market_making", "size":0.000950, "fee_model": "maker",
|
||||
"description": "Dual-sided quoting at best bid/ask — captures spread via stochastic control. Simulated fill when spread is crossed.",
|
||||
},
|
||||
"Momentum Breakout": {
|
||||
"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",
|
||||
"signals": [], "type": "momentum", "size":0.020000, "fee_model": "taker",
|
||||
"description": "Bollinger Band (2σ) breakout — enters when price breaks bands with volume confirmation.",
|
||||
},
|
||||
"Mean Reversion": {
|
||||
"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": "reversal", "size": 0.002, "fee_model": "taker",
|
||||
"signals": [], "type": "reversal", "size":0.022500, "fee_model": "taker",
|
||||
"description": "VWAP deviation — buys below VWAP, sells above. Oscillates around fair value.",
|
||||
},
|
||||
"Hawkes OFI (new)": {
|
||||
@@ -311,15 +311,17 @@ def compute_signals():
|
||||
elif btc < sma - 2*std:
|
||||
STRATEGIES["Momentum Breakout"]["signals"].append({"time":time.time(),"signal":"SELL","strength":(sma-2*std-btc)/std})
|
||||
|
||||
# Mean Reversion
|
||||
if len(btc_prices) >= 20:
|
||||
w = list(btc_prices)[-20:]; vols = [1 + i/len(w) for i in range(len(w))]
|
||||
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 = (btc - vwap) / vstd if vstd > 0 else 0
|
||||
if dev > 1.5:
|
||||
# Mean Reversion: SMA deviation on ETH (prior 19, exclude current)
|
||||
if len(eth_prices) >= 20:
|
||||
w = list(eth_prices)[-20:]
|
||||
eth_now = eth_prices[-1]
|
||||
prior = w[:-1]
|
||||
sma = sum(prior) / len(prior)
|
||||
vstd = math.sqrt(sum((p-sma)**2 for p in prior) / len(prior))
|
||||
dev = (eth_now - 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.5:
|
||||
elif dev < -1.0:
|
||||
STRATEGIES["Mean Reversion"]["signals"].append({"time":time.time(),"signal":"BUY","strength":abs(dev)})
|
||||
|
||||
for s in STRATEGIES.values():
|
||||
@@ -353,7 +355,7 @@ def simulate_fill(name: str, side: str, coin: str, price: float, reason: str = "
|
||||
trades_log.append({
|
||||
"time": datetime.now().strftime("%H:%M:%S"),
|
||||
"strategy": name, "side": "BUY (close short)",
|
||||
"size": abs(cfg["position"] if cfg["position"] < 0 else sz),
|
||||
"size":0.025000,
|
||||
"price": price, "pnl": round(close_pnl - fee - slippage, 4),
|
||||
"fee": round(fee, 4),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user