"""Exchange interface module for OpenClaw trading system.

This module provides abstract exchange interfaces and concrete implementations
for connecting to various trading venues including Binance and stock brokers.
"""

from openclaw.exchange.models import (
    Balance,
    Order,
    OrderSide,
    OrderStatus,
    OrderType,
    Position,
    Ticker,
)
from openclaw.exchange.base import (
    Exchange,
    ExchangeError,
    AuthenticationError,
    InsufficientFundsError,
    InvalidOrderError,
    OrderNotFoundError,
)
from openclaw.exchange.mock import MockExchange
from openclaw.exchange.paper_trading import (
    PaperTradingEngine,
    PaperTradingError,
    PriceFeedError,
    Trade,
    FeeConfig,
    SlippageConfig,
    PositionSummary,
    AccountSummary,
)

# CCXT adapter (optional dependency)
try:
    from openclaw.exchange.ccxt_adapter import (
        CCXTAdapter,
        CCXTExchangeFactory,
        RateLimitConfig,
        RetryConfig,
        ExchangeFeature,
        create_binance,
        create_okx,
        create_bybit,
        create_kucoin,
    )
    CCXT_AVAILABLE = True
except ImportError:
    CCXT_AVAILABLE = False

__all__ = [
    # Base classes
    "Exchange",
    "ExchangeError",
    "AuthenticationError",
    "InsufficientFundsError",
    "InvalidOrderError",
    "OrderNotFoundError",
    # Models
    "Order",
    "OrderSide",
    "OrderType",
    "OrderStatus",
    "Balance",
    "Position",
    "Ticker",
    # Implementations
    "MockExchange",
    # Paper Trading
    "PaperTradingEngine",
    "PaperTradingError",
    "PriceFeedError",
    "Trade",
    "FeeConfig",
    "SlippageConfig",
    "PositionSummary",
    "AccountSummary",
    # CCXT (if available)
    "CCXTAdapter",
    "CCXTExchangeFactory",
    "RateLimitConfig",
    "RetryConfig",
    "ExchangeFeature",
    "create_binance",
    "create_okx",
    "create_bybit",
    "create_kucoin",
    "CCXT_AVAILABLE",
]
