UNPKG

client-twelve-data-rapidapi

Version:

Complete TypeScript library for Twelve Data API with 154 endpoints, technical indicators, and intelligent rate limiting

98 lines (97 loc) 3.15 kB
import { ReferenceDataEndpoints } from "./endpoints/reference-data.js"; import { CoreDataEndpoints } from "./endpoints/core-data"; import { MutualFundsEndpoints } from "./endpoints/mutual-funds"; import { FundamentalsEndpoints } from "./endpoints/fundamentals"; import { AnalysisEndpoints } from "./endpoints/analysis"; import { TechnicalIndicatorsEndpoints } from "./endpoints/technical-indicators"; import type { TwelveDataConfig, ApiResponse } from "./types/index"; /** * Complete Twelve Data API client * Provides access to ALL 154 API endpoints with automatic rate limiting * * Coverage: * - Reference Data: 9/9 endpoints (100%) * - Core Data: 9/9 endpoints (100%) * - Mutual Funds: 12/12 endpoints (100%) * - Fundamentals: 17/17 endpoints (100%) * - Analysis: 9/9 endpoints (100%) * - Technical Indicators: 98/98 endpoints (100%) * * Total: 154/154 endpoints (100% complete) */ export default class TwelveData { private httpClient; readonly referenceData: ReferenceDataEndpoints; readonly coreData: CoreDataEndpoints; readonly mutualFunds: MutualFundsEndpoints; readonly fundamentals: FundamentalsEndpoints; readonly analysis: AnalysisEndpoints; readonly technicalIndicators: TechnicalIndicatorsEndpoints; constructor(config: TwelveDataConfig); /** * Make a custom request to any endpoint * @param endpoint - API endpoint path * @param params - Request parameters * @returns Promise with API response */ customRequest<T = any>(endpoint: string, params?: Record<string, any>): Promise<ApiResponse<T>>; /** * Get current rate limiter status * @returns Rate limiter status information */ getRateLimiterStatus(): { tokens: number; queueLength: number; }; /** * Reset the rate limiter */ resetRateLimiter(): void; /** * Update API key * @param apiKey - New API key */ updateApiKey(apiKey: string): void; /** * Get library statistics * @returns Statistics about endpoint coverage */ getLibraryStats(): { total_endpoints: number; implemented_endpoints: number; coverage_percentage: number; categories: { reference_data: { implemented: number; total: number; percentage: number; }; core_data: { implemented: number; total: number; percentage: number; }; mutual_funds: { implemented: number; total: number; percentage: number; }; fundamentals: { implemented: number; total: number; percentage: number; }; analysis: { implemented: number; total: number; percentage: number; }; technical_indicators: { implemented: number; total: number; percentage: number; }; }; features: string[]; }; }