export type BacktestStatus = 
  | 'idle' 
  | 'configured' 
  | 'running' 
  | 'paused' 
  | 'stopped' 
  | 'completed' 
  | 'error';

export interface BacktestConfig {
  name: string;
  startDate: Date;
  endDate: Date;
  initialCapital: number;
  symbols: string[];
  strategy: string;
  speedMultiplier: number;
  commission: number;
  slippage: number;
}

export interface BacktestMetrics {
  totalReturn: number;
  sharpeRatio: number;
  maxDrawdown: number;
  winRate: number;
  totalTrades: number;
  profitableTrades: number;
}

export interface Position {
  symbol: string;
  quantity: number;
  averagePrice: number;
  currentPrice: number;
  realizedPnl: number;
  unrealizedPnl: number;
  lastUpdate: string;
}

export interface Trade {
  id: string;
  timestamp: string;
  symbol: string;
  side: 'buy' | 'sell';
  quantity: number;
  price: number;
  commission: number;
  pnl?: number;
  positionAfter: number; // Position size after this trade
}

export interface PerformanceDataPoint {
  timestamp: string;
  portfolioValue: number;
  pnl: number;
  drawdown: number;
}

export interface BacktestResult {
  id: string;
  config: BacktestConfig;
  metrics: BacktestMetrics;
  positions: Position[];
  trades: Trade[];
  performanceData: PerformanceDataPoint[];
}

export interface OrderBookLevel {
  price: number;
  size: number;
  orderCount?: number;
}

export interface OrderBookSnapshot {
  symbol: string;
  timestamp: string;
  bids: OrderBookLevel[];
  asks: OrderBookLevel[];
}

export interface RiskMetrics {
  currentExposure: number;
  dailyPnl: number;
  positionCount: number;
  grossExposure: number;
  maxPositionSize: number;
  utilizationPct: number;
}