// Enhanced stock price interface with additional OHLCV data export interface IStockPrice { ticker: string; price: number; currency: string; change: number; changePercent: number; previousClose: number; timestamp: Date; provider: string; marketState: 'PRE' | 'REGULAR' | 'POST' | 'CLOSED'; exchange?: string; exchangeName?: string; // Phase 1 enhancements volume?: number; // Trading volume open?: number; // Opening price high?: number; // Day high low?: number; // Day low adjusted?: boolean; // If price is split/dividend adjusted dataType: 'eod' | 'intraday' | 'live'; // What kind of data this is fetchedAt: Date; // When we fetched (vs data timestamp) // Company identification companyName?: string; // Company name (e.g., "Apple Inc.") companyFullName?: string; // Full company name with exchange (e.g., "Apple Inc. (NASDAQ:AAPL)") } export interface IStockPriceError { ticker: string; error: string; provider: string; timestamp: Date; } // Pagination support for large datasets export interface IPaginatedResponse { data: T[]; pagination: { currentPage: number; totalPages: number; totalRecords: number; hasMore: boolean; limit: number; offset: number; }; } // Phase 1: Discriminated union types for different request types export type TIntervalType = '1min' | '5min' | '10min' | '15min' | '30min' | '1hour'; export type TSortOrder = 'ASC' | 'DESC'; // Current price request (latest EOD or live) export interface IStockCurrentRequest { type: 'current'; ticker: string; exchange?: string; // MIC code like 'XNAS', 'XNYS', 'XLON' } // Historical price request (date range) export interface IStockHistoricalRequest { type: 'historical'; ticker: string; from: Date; to: Date; exchange?: string; sort?: TSortOrder; limit?: number; // Max results per page (default 1000) offset?: number; // For pagination } // Intraday price request (real-time intervals) export interface IStockIntradayRequest { type: 'intraday'; ticker: string; interval: TIntervalType; exchange?: string; limit?: number; // Number of bars to return date?: Date; // Specific date for historical intraday } // Batch current prices request export interface IStockBatchCurrentRequest { type: 'batch'; tickers: string[]; exchange?: string; } // Union type for all stock data requests export type IStockDataRequest = | IStockCurrentRequest | IStockHistoricalRequest | IStockIntradayRequest | IStockBatchCurrentRequest;