update readme
This commit is contained in:
28
readme.md
28
readme.md
@@ -19,13 +19,12 @@ pnpm add @fin.cx/opendata
|
|||||||
Get complete stock data with automatic enrichment - the elegant way:
|
Get complete stock data with automatic enrichment - the elegant way:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { StockDataService, YahooFinanceProvider, SecEdgarProvider } from '@fin.cx/opendata';
|
import { StockDataService, SecEdgarProvider } from '@fin.cx/opendata';
|
||||||
|
|
||||||
// Initialize unified service
|
// Initialize unified service
|
||||||
const stockData = new StockDataService();
|
const stockData = new StockDataService();
|
||||||
|
|
||||||
// Register providers
|
// Register providers
|
||||||
stockData.registerPriceProvider(new YahooFinanceProvider());
|
|
||||||
stockData.registerFundamentalsProvider(new SecEdgarProvider({
|
stockData.registerFundamentalsProvider(new SecEdgarProvider({
|
||||||
userAgent: 'YourCompany youremail@example.com'
|
userAgent: 'YourCompany youremail@example.com'
|
||||||
}));
|
}));
|
||||||
@@ -68,10 +67,10 @@ stocks.forEach(stock => {
|
|||||||
If you only need prices without fundamentals:
|
If you only need prices without fundamentals:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { StockDataService, YahooFinanceProvider } from '@fin.cx/opendata';
|
import { StockDataService, MarketstackProvider } from '@fin.cx/opendata';
|
||||||
|
|
||||||
const stockData = new StockDataService();
|
const stockData = new StockDataService();
|
||||||
stockData.registerPriceProvider(new YahooFinanceProvider());
|
stockData.registerPriceProvider(new MarketstackProvider('YOUR_API_KEY'));
|
||||||
|
|
||||||
// Get just the price
|
// Get just the price
|
||||||
const price = await stockData.getPrice('AAPL');
|
const price = await stockData.getPrice('AAPL');
|
||||||
@@ -81,7 +80,7 @@ console.log(`${price.ticker}: $${price.price}`);
|
|||||||
import { StockPriceService } from '@fin.cx/opendata';
|
import { StockPriceService } from '@fin.cx/opendata';
|
||||||
|
|
||||||
const stockService = new StockPriceService({ ttl: 60000 });
|
const stockService = new StockPriceService({ ttl: 60000 });
|
||||||
stockService.register(new YahooFinanceProvider());
|
stockService.register(new MarketstackProvider('YOUR_API_KEY'));
|
||||||
|
|
||||||
const apple = await stockService.getData({ type: 'current', ticker: 'AAPL' });
|
const apple = await stockService.getData({ type: 'current', ticker: 'AAPL' });
|
||||||
console.log(`${apple.companyFullName}: $${apple.price}`);
|
console.log(`${apple.companyFullName}: $${apple.price}`);
|
||||||
@@ -201,7 +200,7 @@ const details = await openData.handelsregister.getSpecificCompany({
|
|||||||
|
|
||||||
### 📊 Stock & Crypto Market Module
|
### 📊 Stock & Crypto Market Module
|
||||||
|
|
||||||
- **Real-Time Prices** - Live and EOD prices from Yahoo Finance, Marketstack, and CoinGecko
|
- **Real-Time Prices** - Live and EOD prices from Marketstack and CoinGecko
|
||||||
- **Cryptocurrency Support** - 13M+ crypto tokens with 24/7 market data via CoinGecko
|
- **Cryptocurrency Support** - 13M+ crypto tokens with 24/7 market data via CoinGecko
|
||||||
- **Company Names** - Automatic company name extraction (e.g., "Apple Inc (NASDAQ:AAPL)")
|
- **Company Names** - Automatic company name extraction (e.g., "Apple Inc (NASDAQ:AAPL)")
|
||||||
- **Historical Data** - Up to 15 years of daily EOD prices with pagination
|
- **Historical Data** - Up to 15 years of daily EOD prices with pagination
|
||||||
@@ -238,11 +237,11 @@ const details = await openData.handelsregister.getSpecificCompany({
|
|||||||
Analyze multiple companies with automatic enrichment:
|
Analyze multiple companies with automatic enrichment:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { StockDataService, YahooFinanceProvider, SecEdgarProvider } from '@fin.cx/opendata';
|
import { StockDataService, MarketstackProvider, SecEdgarProvider } from '@fin.cx/opendata';
|
||||||
|
|
||||||
// Setup unified service
|
// Setup unified service
|
||||||
const stockData = new StockDataService();
|
const stockData = new StockDataService();
|
||||||
stockData.registerPriceProvider(new YahooFinanceProvider());
|
stockData.registerPriceProvider(new MarketstackProvider('YOUR_API_KEY'));
|
||||||
stockData.registerFundamentalsProvider(new SecEdgarProvider({
|
stockData.registerFundamentalsProvider(new SecEdgarProvider({
|
||||||
userAgent: 'YourCompany youremail@example.com'
|
userAgent: 'YourCompany youremail@example.com'
|
||||||
}));
|
}));
|
||||||
@@ -487,12 +486,6 @@ stockService.register(new MarketstackProvider('YOUR_API_KEY'), {
|
|||||||
retryAttempts: 3,
|
retryAttempts: 3,
|
||||||
retryDelay: 1000
|
retryDelay: 1000
|
||||||
});
|
});
|
||||||
|
|
||||||
// Yahoo Finance - Real-time data (no API key)
|
|
||||||
stockService.register(new YahooFinanceProvider(), {
|
|
||||||
enabled: true,
|
|
||||||
priority: 50
|
|
||||||
});
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Fundamentals Service Options
|
### Fundamentals Service Options
|
||||||
@@ -666,13 +659,6 @@ interface IStockFundamentals {
|
|||||||
- ✅ Company names included automatically
|
- ✅ Company names included automatically
|
||||||
- ⚠️ Requires API key (free tier: 100 requests/month)
|
- ⚠️ Requires API key (free tier: 100 requests/month)
|
||||||
|
|
||||||
**YahooFinanceProvider**
|
|
||||||
- ✅ Real-time stock prices
|
|
||||||
- ✅ No API key required
|
|
||||||
- ✅ Global coverage
|
|
||||||
- ✅ Company names included
|
|
||||||
- ⚠️ Rate limits may apply
|
|
||||||
|
|
||||||
**CoinGeckoProvider**
|
**CoinGeckoProvider**
|
||||||
- ✅ Cryptocurrency prices (Bitcoin, Ethereum, 13M+ tokens)
|
- ✅ Cryptocurrency prices (Bitcoin, Ethereum, 13M+ tokens)
|
||||||
- ✅ Current, historical, and intraday data
|
- ✅ Current, historical, and intraday data
|
||||||
|
|||||||
Reference in New Issue
Block a user