66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import type { IStockPrice } from './stockprice.js';
|
|
import type { IStockFundamentals } from './fundamentals.js';
|
|
|
|
/**
|
|
* Combined stock data with price and fundamentals
|
|
* All calculated metrics (market cap, P/E, P/B) are automatically included
|
|
*/
|
|
export interface IStockData {
|
|
/** Stock ticker symbol */
|
|
ticker: string;
|
|
|
|
/** Price information */
|
|
price: IStockPrice;
|
|
|
|
/** Fundamental data (optional - may not be available for all stocks) */
|
|
fundamentals?: IStockFundamentals;
|
|
|
|
/** When this combined data was fetched */
|
|
fetchedAt: Date;
|
|
}
|
|
|
|
/**
|
|
* Configuration for StockDataService
|
|
*/
|
|
export interface IStockDataServiceConfig {
|
|
/** Cache configuration */
|
|
cache?: {
|
|
/** TTL for price data (default: 24 hours) */
|
|
priceTTL?: number;
|
|
/** TTL for fundamentals data (default: 90 days) */
|
|
fundamentalsTTL?: number;
|
|
/** Max cache entries (default: 10000) */
|
|
maxEntries?: number;
|
|
};
|
|
|
|
/** Provider timeouts */
|
|
timeout?: {
|
|
/** Timeout for price providers (default: 10000ms) */
|
|
price?: number;
|
|
/** Timeout for fundamentals providers (default: 30000ms) */
|
|
fundamentals?: number;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Request type for getting complete stock data
|
|
*/
|
|
export interface ICompleteStockDataRequest {
|
|
ticker: string;
|
|
/** Whether to include fundamentals (default: true) */
|
|
includeFundamentals?: boolean;
|
|
/** Whether to enrich fundamentals with price calculations (default: true) */
|
|
enrichFundamentals?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Batch request for multiple stocks
|
|
*/
|
|
export interface ICompleteStockDataBatchRequest {
|
|
tickers: string[];
|
|
/** Whether to include fundamentals (default: true) */
|
|
includeFundamentals?: boolean;
|
|
/** Whether to enrich fundamentals with price calculations (default: true) */
|
|
enrichFundamentals?: boolean;
|
|
}
|