addd debug logging so i can know where the point of failure is from dataclasses import dataclass, field
from typing import Dict, Any

@dataclass(frozen=True)
class SystemConfig:
    threads: int = 8
    queue_size: int = 1000
    batch_processing: bool = True
    memory_threshold: float = 0.9
    cache_ttl: int = 3600
    log_level: str = "INFO"
    metrics_interval: int = 1

@dataclass(frozen=True)
class SandwichConfig:
    min_victim_size: float = 0.1
    max_victim_size: float = 5.0
    front_run_multiplier: float = 0.5
    back_run_multiplier: float = 1.1
    max_impact: float = 0.003
    min_profit: float = 0.002
    max_wait_time: float = 0.1
    confidence_threshold: float = 0.85

@dataclass(frozen=True)
class ImpactConfig:
    min_threshold: float = 0.002
    max_threshold: float = 0.004
    min_size: float = 0.05
    max_size: float = 0.5
    size_multiplier: float = 0.7
    confidence_threshold: float = 0.8

@dataclass(frozen=True)
class ExecutionConfig:
    compute_limit: int = 400000
    priority_fee: int = 500000
    max_priority_fee: int = 1000000
    min_priority_fee: int = 50000
    fee_multiplier: float = 1.5
    slippage: float = 0.01
    retry_count: int = 3
    gas_reserve: float = 0.1
    timeout: int = 60

@dataclass(frozen=True)
class GPUConfig:
    memory_fraction: float = 0.8
    use_tensor_cores: bool = True
    batch_size: int = 256
    precision: str = "float16"
    cudnn_benchmark: bool = True
    allow_tf32: bool = True
    allow_fp16_reduction: bool = True
    max_split_size_mb: int = 512
    stream_priorities: Dict[str, int] = field(default_factory=lambda: {
        "process": -2,
        "compute": -1,
        "update": 0
    })

@dataclass(frozen=True)
class TradingConfig:
    # RPC Settings
    helius_endpoint: str = "https://marga-e56m84-fast-mainnet.helius-rpc.com"
    helius_ws: str = "wss://marga-e56m84-fast-mainnet.helius-rpc.com"
    max_tps: int = 5
    use_priority_fee: bool = True

    # System Configuration
    system: SystemConfig = SystemConfig()
    
    # Execution Parameters
    execution: ExecutionConfig = ExecutionConfig()
    
    # Trading Strategies
    sandwich: SandwichConfig = SandwichConfig()
    impact: ImpactConfig = ImpactConfig()
    
    # GPU Configuration
    gpu: GPUConfig = GPUConfig()
    
    # Position Management
    position_size: float = 0.05
    max_position_size: float = 0.15
    initial_size: float = 0.05
    scale_increment: float = 0.02
    position_timeout: int = 1
    min_profit_usd: float = 0.50
    success_threshold: int = 3

    # Trading Limits
    min_profit_pct: float = 1.5
    max_profit_pct: float = 4.0
    stop_loss_pct: float = 0.5
    max_price_impact: float = 0.004
    max_spread: float = 0.003
    max_trades_per_second: int = 2

    # Program IDs
    raydium_program_id: str = "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"
    token_program_id: str = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
    system_program_id: str = "11111111111111111111111111111111"
    serum_program_id: str = "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"

    # WebSocket Settings
    ws_ping_interval: int = 30
    ws_ping_timeout: int = 10
    ws_close_timeout: int = 60
    ws_max_message_size: int = 16777216

    # Market Accounts
    sol_wsol_accounts: Dict[str, str] = field(default_factory=lambda: {
        "amm_id": "2E1F6xmYAUkFkEG9NvHxuMqPMnv5GzSdehGtHXS1N8PX",
        "base_mint": "So11111111111111111111111111111111111111112",
        "quote_mint": "So11111111111111111111111111111111111111112",
        "amm_authority": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1",
        "amm_open_orders": "2CxiJ1rUJF1CfH1JNHnzxCPCEMpzXwQqJex1KVRyQUcY",
        "amm_target": "FDDTzmvtjQGvFKgceFn2AY4SLVzM6GiBiZBHYzV6Vxv7",
        "pool_coin_token_account": "EV1LfYqbD4G1YsRArGwH6bSd9BNSzJz3T7U2mZ8PsyRG",
        "pool_pc_token_account": "EXjE7iWBtx2GqUxwVJHpGBZ6zNz5xNuUonAtS2MZqe7v",
        "serum_market": "2E1F6xmYAUkFkEG9NvHxuMqPMnv5GzSdehGtHXS1N8PX",
        "serum_bids": "F4LnU7SarP7nLmGPnFJLcpgGvJw6SWbgTqr9UPxFZTfh",
        "serum_asks": "BrDFhqHxKxnAFPfxp2vLAa8qBTRoyeyjd8JKCXGUKgTT",
        "serum_events": "HdGTvR6vR4JjRCmD5DTpWDHRyeHxcgDj7CmGGvcrAqZP",
        "vault_signer": "HveqosDhKqP7jKwKdoR5nKxY7XatGy6rj8qTqcJ7F7Xg"
    })