update 03-29 01:36
This commit is contained in:
30
backtest.py
30
backtest.py
@@ -194,15 +194,15 @@ class Backtester:
|
||||
|
||||
# Simulate Polymarket price (lagging behind reality)
|
||||
if abs(change_pct) > 0.05:
|
||||
lag_factor = 0.3 # Polymarket adjusts at 30% of actual
|
||||
lag_factor = 0.8 # Polymarket adjusts slowly behind CEX
|
||||
if change_pct > 0:
|
||||
sim_poly_up = 0.50 + abs(change_pct) * lag_factor * 10
|
||||
sim_poly_up = min(sim_poly_up, 0.75)
|
||||
sim_poly_down = max(0.25, 1.0 - sim_poly_up - rng.uniform(0, 0.04))
|
||||
sim_poly_up = 0.50 + abs(change_pct) * lag_factor
|
||||
sim_poly_up = min(sim_poly_up, 0.70)
|
||||
sim_poly_down = max(0.30, 1.0 - sim_poly_up - rng.uniform(0, 0.04))
|
||||
else:
|
||||
sim_poly_down = 0.50 + abs(change_pct) * lag_factor * 10
|
||||
sim_poly_down = min(sim_poly_down, 0.75)
|
||||
sim_poly_up = max(0.25, 1.0 - sim_poly_down - rng.uniform(0, 0.04))
|
||||
sim_poly_down = 0.50 + abs(change_pct) * lag_factor
|
||||
sim_poly_down = min(sim_poly_down, 0.70)
|
||||
sim_poly_up = max(0.30, 1.0 - sim_poly_down - rng.uniform(0, 0.04))
|
||||
else:
|
||||
sim_poly_up = 0.50 + rng.uniform(-0.02, 0.02)
|
||||
sim_poly_down = 0.50 + rng.uniform(-0.02, 0.02)
|
||||
@@ -370,17 +370,17 @@ class Backtester:
|
||||
change_pct = (mid_price - start_price) / start_price * 100
|
||||
|
||||
# Simulate Polymarket prices based on actual market behavior
|
||||
# More conservative lag simulation for historical
|
||||
# Conservative lag simulation for historical data
|
||||
if abs(change_pct) > 0.05:
|
||||
lag = 0.25 # Market adjusts at ~25% speed
|
||||
lag = 0.6 # Market adjusts at ~60% speed
|
||||
if change_pct > 0:
|
||||
poly_up = 0.50 + abs(change_pct) * lag * 8
|
||||
poly_up = min(poly_up, 0.72)
|
||||
poly_down = max(0.28, 1.0 - poly_up - 0.02)
|
||||
poly_up = 0.50 + abs(change_pct) * lag
|
||||
poly_up = min(poly_up, 0.68)
|
||||
poly_down = max(0.32, 1.0 - poly_up - 0.02)
|
||||
else:
|
||||
poly_down = 0.50 + abs(change_pct) * lag * 8
|
||||
poly_down = min(poly_down, 0.72)
|
||||
poly_up = max(0.28, 1.0 - poly_down - 0.02)
|
||||
poly_down = 0.50 + abs(change_pct) * lag
|
||||
poly_down = min(poly_down, 0.68)
|
||||
poly_up = max(0.32, 1.0 - poly_down - 0.02)
|
||||
else:
|
||||
poly_up = 0.50
|
||||
poly_down = 0.50
|
||||
|
||||
Reference in New Issue
Block a user