UNPKG

@fin.cx/opendata

Version:

A comprehensive TypeScript library for accessing business data and real-time financial information. Features include German company data management with MongoDB integration, JSONL bulk processing, automated Handelsregister interactions, and real-time stoc

83 lines (82 loc) 2.49 kB
/** * Interfaces for stock fundamental data (financials from SEC filings) * Separate from stock price data (OHLCV) to maintain clean architecture */ export interface IFundamentalsCurrentRequest { type: 'fundamentals-current'; ticker: string; } export interface IFundamentalsBatchRequest { type: 'fundamentals-batch'; tickers: string[]; } export type IFundamentalsRequest = IFundamentalsCurrentRequest | IFundamentalsBatchRequest; /** * Stock fundamental data from SEC filings (10-K, 10-Q) * Contains financial metrics like EPS, Revenue, Assets, etc. */ export interface IStockFundamentals { ticker: string; cik: string; companyName: string; provider: string; timestamp: Date; fetchedAt: Date; earningsPerShareBasic?: number; earningsPerShareDiluted?: number; sharesOutstanding?: number; weightedAverageSharesOutstanding?: number; revenue?: number; netIncome?: number; operatingIncome?: number; grossProfit?: number; costOfRevenue?: number; assets?: number; liabilities?: number; stockholdersEquity?: number; cash?: number; propertyPlantEquipment?: number; marketCap?: number; priceToEarnings?: number; priceToBook?: number; fiscalYear?: string; fiscalQuarter?: string; filingDate?: Date; form?: '10-K' | '10-Q' | string; } /** * Provider interface for fetching fundamental data * Parallel to IStockProvider but for fundamentals instead of prices */ export interface IFundamentalsProvider { name: string; priority: number; fetchData(request: IFundamentalsRequest): Promise<IStockFundamentals | IStockFundamentals[]>; isAvailable(): Promise<boolean>; readonly requiresAuth: boolean; readonly rateLimit?: { requestsPerMinute: number; requestsPerDay?: number; }; } /** * Configuration for fundamentals providers */ export interface IFundamentalsProviderConfig { enabled: boolean; priority?: number; timeout?: number; retryAttempts?: number; retryDelay?: number; cacheTTL?: number; } /** * Registry for managing fundamental data providers */ export interface IFundamentalsProviderRegistry { register(provider: IFundamentalsProvider, config?: IFundamentalsProviderConfig): void; unregister(providerName: string): void; getProvider(name: string): IFundamentalsProvider | undefined; getAllProviders(): IFundamentalsProvider[]; getEnabledProviders(): IFundamentalsProvider[]; }