The stocks module provides real-time stock price data through various provider implementations. Currently supports Yahoo Finance with an extensible architecture for additional providers.
### Architecture
- **Provider Pattern**: Each stock data source implements the `IStockProvider` interface
- **Service Registry**: `StockPriceService` manages providers with priority-based selection
- **Caching**: Built-in cache with configurable TTL to reduce API calls
- **Fallback Logic**: Automatic failover between providers if one fails
### Yahoo Finance Provider Notes
- Uses public API endpoints (no authentication required)
- Two main endpoints:
-`/v8/finance/chart/{ticker}` - Single ticker with full data
-`/v8/finance/spark?symbols={tickers}` - Multiple tickers with basic data
- Response data is in `response.body` when using smartrequest
- Requires User-Agent header to avoid rate limiting
### Usage Example
```typescript
import { StockPriceService, YahooFinanceProvider } from '@fin.cx/opendata';
const stockService = new StockPriceService({ ttl: 60000 });