"""
PolyEdge Configuration
"""

# =============================================================================
# MARKET STRUCTURE
# =============================================================================
MARKET_DURATION_MIN = 5          # 5-minute binary markets
RESOLUTION_ASSET = "BTCUSD"      # Underlying asset

# =============================================================================
# FAIR VALUE MODEL
# =============================================================================
VOL_LOOKBACK_BARS = 60           # Bars to calculate realized vol (5 hours)
VOL_EWMA_SPAN = 20              # EWMA span for vol smoothing
MOMENTUM_LOOKBACK = 6            # Bars for momentum adjustment
MOMENTUM_WEIGHT = 0.3            # How much momentum shifts fair value (0-1)

# =============================================================================
# SIGNAL THRESHOLDS
# =============================================================================
MIN_EDGE = 0.04                  # Minimum edge to trade (4% mispricing)
STRONG_EDGE = 0.08               # Strong edge threshold (8%)
MAX_MARKET_PRICE = 0.88          # Don't buy YES above this (risk/reward too low)
MIN_MARKET_PRICE = 0.12          # Don't buy YES below this (too speculative)

# =============================================================================
# POSITION SIZING (Kelly Criterion)
# =============================================================================
KELLY_FRACTION = 0.25            # Quarter Kelly (conservative)
BASE_BET_PCT = 0.02              # 2% of bankroll per trade (fallback)
MAX_BET_PCT = 0.05               # Never risk more than 5% per trade
MIN_BET_USD = 1.0                # Polymarket minimum
MAX_BET_USD = 100.0              # Cap per trade

# =============================================================================
# RISK MANAGEMENT
# =============================================================================
MAX_DAILY_LOSS_PCT = 0.10        # Stop trading after 10% daily loss
MAX_CONSECUTIVE_LOSSES = 8       # Pause after 8 straight losses
COOLDOWN_BARS = 6                # Wait 30 min after max losses hit
MAX_OPEN_POSITIONS = 3           # Max concurrent positions
BANKROLL_FLOOR_PCT = 0.50        # Stop if bankroll drops below 50% of start

# =============================================================================
# FEES (Polymarket 5-min crypto markets)
# =============================================================================
# Taker fee = baseRate * min(price, 1-price) * size
# Maker fee = 0
TAKER_FEE_BPS = 200              # 2% base rate for taker (estimated)
MAKER_FEE_BPS = 0                # Makers trade free
USE_LIMIT_ORDERS = True          # Prefer limit orders (0 fees)

# =============================================================================
# BACKTEST
# =============================================================================
INITIAL_BANKROLL = 1000.0        # Starting capital for backtests
SLIPPAGE_PCT = 0.005             # 0.5% slippage model
COMMISSION_MODEL = "taker"       # "taker", "maker", or "mixed"
