"""Horizon — Prediction Market Trading SDK."""

__version__ = "0.1.0"

from horizon._horizon import (
    AlertLevel,
    ArbitrageOpportunity,
    ContingentOrder,
    Engine,
    EngineStatus,
    Event,
    EventArbitrageOpportunity,
    FeedSnapshot,
    Fill,
    Market,
    Order,
    OrderbookSnapshot,
    OrderRequest,
    OrderSide,
    OrderStatus,
    OrderType,
    Outcome,
    ParityResult,
    Position,
    Quote,
    RiskConfig,
    Side,
    TimeInForce,
    TriggerType,
    # Kelly criterion functions (Rust, #[inline])
    edge,
    fractional_kelly,
    kelly,
    kelly_no,
    kelly_size,
    liquidity_adjusted_kelly,
    multi_kelly,
)
from horizon.aggregator import AggregatedPrice, PriceAggregator
from horizon.alerts import (
    Alert,
    AlertManager,
    AlertType,
    DiscordChannel,
    LogChannel,
    TelegramChannel,
    WebhookChannel,
)
from horizon.algos import TWAP, VWAP, ExecAlgo, Iceberg
from horizon.calibration import CalibrationTracker
from horizon.context import Context
from horizon.discovery import discover_events, discover_markets
from horizon.exchanges import Kalshi, Polymarket
from horizon.feeds import BinanceWS, KalshiBook, PolymarketBook, RESTFeed
from horizon.kelly_sizer import kelly_sizer, kelly_sizer_with_liquidity
from horizon.metrics import MetricsCollector, MetricsServer, update_engine_metrics
from horizon.backtest import backtest
from horizon.result import BacktestResult
from horizon.risk import Risk
from horizon.strategy import run

__all__ = [
    # Version
    "__version__",
    # Core entry points
    "run",
    "backtest",
    "BacktestResult",
    # Rust types
    "Engine",
    "Side",
    "OrderSide",
    "OrderType",
    "TimeInForce",
    "OrderStatus",
    "AlertLevel",
    "Market",
    "Quote",
    "RiskConfig",
    "OrderRequest",
    "Order",
    "Position",
    "Fill",
    "EngineStatus",
    "FeedSnapshot",
    # Multi-outcome events
    "Outcome",
    "Event",
    "EventArbitrageOpportunity",
    # Python types
    "Context",
    "Risk",
    # Feeds
    "BinanceWS",
    "RESTFeed",
    "PolymarketBook",
    "KalshiBook",
    # Exchanges
    "Polymarket",
    "Kalshi",
    # Contingent orders
    "TriggerType",
    "ContingentOrder",
    # Execution algorithms
    "ExecAlgo",
    "TWAP",
    "VWAP",
    "Iceberg",
    # Kelly criterion (Rust)
    "kelly",
    "kelly_no",
    "fractional_kelly",
    "kelly_size",
    "multi_kelly",
    "liquidity_adjusted_kelly",
    "edge",
    # Kelly pipeline sizers
    "kelly_sizer",
    "kelly_sizer_with_liquidity",
    # Parity / Arbitrage
    "ParityResult",
    "ArbitrageOpportunity",
    # Calibration
    "CalibrationTracker",
    # Discovery
    "discover_markets",
    "discover_events",
    # Phase 4: Market Data + Monitoring
    "OrderbookSnapshot",
    "PriceAggregator",
    "AggregatedPrice",
    "AlertManager",
    "AlertType",
    "Alert",
    "WebhookChannel",
    "TelegramChannel",
    "DiscordChannel",
    "LogChannel",
    "MetricsCollector",
    "MetricsServer",
    "update_engine_metrics",
]


def quotes(fair: float, spread: float, size: float = 5.0) -> list[Quote]:
    """Helper to create a Quote from fair value and spread."""
    half = spread / 2
    return [Quote(bid=fair - half, ask=fair + half, size=size)]
