/**
 * Market Data Types
 * Standard types for market data and pricing information
 */

/**
 * Standard OHLCV (Open, High, Low, Close, Volume) data structure
 * Used for candlestick/bar chart data across all market data providers
 */
export interface OHLCV {
  /** Opening price for the time period */
  open: number;
  /** Highest price during the time period */
  high: number;
  /** Lowest price during the time period */
  low: number;
  /** Closing price for the time period */
  close: number;
  /** Trading volume during the time period */
  volume: number;
  /** Timestamp of the data point (Unix timestamp in milliseconds) */
  timestamp: number;
  /** Symbol/ticker for the security */
  symbol: string;
  /** Time interval (e.g., '1m', '5m', '1h', '1d') */
  interval?: string;
}

/**
 * OHLCV data with additional metadata
 */
export interface OHLCVWithMetadata extends OHLCV {
  /** Source of the data (e.g., 'yahoo', 'ib', 'quotemedia') */
  source: string;
  /** Whether this is adjusted data */
  adjusted?: boolean;
  /** Number of trades during the period */
  trades?: number;
  /** Volume weighted average price */
  vwap?: number;
}

/**
 * Market data structure
 */
export interface MarketData {
  /** Security symbol */
  symbol: string;
  /** Current price */
  price: number;
  /** Trading volume */
  volume: number;
  /** Timestamp */
  timestamp: number;
  /** Bid price */
  bid?: number;
  /** Ask price */
  ask?: number;
  /** Bid size */
  bidSize?: number;
  /** Ask size */
  askSize?: number;
  /** Previous close */
  previousClose?: number;
  /** Day's high */
  high?: number;
  /** Day's low */
  low?: number;
  /** Day's open */
  open?: number;
}

/**
 * Market liquidity metrics
 */
export interface LiquidityMetrics {
  /** Bid-ask spread */
  bidAskSpread: number;
  /** Bid-ask spread percentage */
  bidAskSpreadPercent: number;
  /** Market depth */
  marketDepth: number;
  /** Average daily volume */
  averageDailyVolume: number;
  /** Volume rate */
  volumeRate: number;
  /** Price impact */
  priceImpact: number;
  /** Liquidity score */
  liquidityScore: number;
}

/**
 * Market regime classification
 */
export interface MarketRegime {
  /** Current regime */
  regime: 'trending' | 'ranging' | 'volatile' | 'quiet';
  /** Regime strength (0-1) */
  strength: number;
  /** Regime duration (periods) */
  duration: number;
  /** Trend direction (if trending) */
  trendDirection?: 'up' | 'down';
  /** Volatility level */
  volatilityLevel: 'low' | 'medium' | 'high';
}
