ALTER TABLE ai_trade_memory 
ADD COLUMN exit_price DECIMAL(20, 8) DEFAULT NULL,
ADD COLUMN result VARCHAR(20) DEFAULT NULL,
ADD COLUMN pnl_percent DECIMAL(10, 2) DEFAULT NULL,
ADD COLUMN closed_at TIMESTAMP NULL DEFAULT NULL,
ADD COLUMN is_monitored BOOLEAN DEFAULT TRUE;

CREATE TABLE IF NOT EXISTS ai_accuracy_stats (
    symbol VARCHAR(20) PRIMARY KEY,
    total_trades INT DEFAULT 0,
    wins INT DEFAULT 0,
    losses INT DEFAULT 0,
    win_rate DECIMAL(5, 2) DEFAULT 0.00,
    total_pnl_percent DECIMAL(10, 2) DEFAULT 0.00,
    last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
