@baguskto/saham
Version:
MCP Server untuk data saham Indonesia (IDX) - Implementasi Node.js/TypeScript
81 lines • 2.4 kB
TypeScript
/**
* Historical Data Service for Indonesian Stock Market data
* Integrates with Dataset-Saham-IDX repository
*/
import { RepositoryInfo } from '../utils/github-api';
import { ParsedStockData, StockDataPoint } from './csv-parser';
export interface HistoricalDataOptions {
useCache?: boolean;
cacheTTL?: number;
forceRefresh?: boolean;
}
export interface StockMetadata {
ticker: string;
lastUpdated: Date;
dataPoints: number;
dateRange: {
start: Date;
end: Date;
};
fileSize: number;
}
export declare class HistoricalDataService {
private githubApi;
private dataDir;
private metadataDir;
private defaultCacheTTL;
constructor();
/**
* Ensure required directories exist
*/
private ensureDirectories;
/**
* Get historical data for a specific stock
*/
getStockData(ticker: string, options?: HistoricalDataOptions): Promise<ParsedStockData>;
/**
* Get historical data for multiple stocks
*/
getMultipleStocksData(tickers: string[], options?: HistoricalDataOptions): Promise<Record<string, ParsedStockData>>;
/**
* Get available stock tickers from the repository
*/
getAvailableStocks(): Promise<string[]>;
/**
* Get repository information
*/
getRepositoryInfo(): Promise<RepositoryInfo>;
/**
* Check if stock data is available
*/
isStockAvailable(ticker: string): Promise<boolean>;
/**
* Get stock data for a specific time period
*/
getStockDataForPeriod(ticker: string, period: string, options?: HistoricalDataOptions): Promise<StockDataPoint[]>;
/**
* Get stock data for a custom date range
*/
getStockDataForDateRange(ticker: string, startDate: Date, endDate: Date, options?: HistoricalDataOptions): Promise<StockDataPoint[]>;
/**
* Get metadata for cached stocks
*/
getCachedStockMetadata(): Promise<StockMetadata[]>;
/**
* Clear cache for a specific stock or all stocks
*/
clearCache(ticker?: string): Promise<void>;
/**
* Get cached data if available and not expired
*/
private getCachedData;
/**
* Cache parsed data and metadata
*/
private cacheData;
/**
* Utility function to chunk array into smaller arrays
*/
private chunkArray;
}
//# sourceMappingURL=historical-data-service.d.ts.map