rates-api / src/services/providers/liveCoinWatch / LiveCoinWatch
Defined in: src/services/providers/liveCoinWatch.ts:28
Singleton class to interact with the LiveCoinWatch API.
This class provides methods to retrieve cryptocurrency exchange rates from LiveCoinWatch. It handles API requests, caching, and rate limiting.
import { LiveCoinWatch } from './livecoinwatch';
async function fetchExchangeRates() {
const liveCoinWatch = LiveCoinWatch.getInstance();
const rates = await liveCoinWatch.getExchangeRates(['BTC', 'ETH'], 'USD');
console.log('Exchange Rates:', rates);
}
fetchExchangeRates();new LiveCoinWatch():
LiveCoinWatch
Defined in: src/services/providers/liveCoinWatch.ts:69
Private constructor to enforce the singleton pattern.
Initializes the AxiosWrapper and the LRU cache.
LiveCoinWatch
If an instance already exists.
getExchangeRates(
ids,vsCurrency?):Promise<LiveCoinWatchMarket[]>
Defined in: src/services/providers/liveCoinWatch.ts:164
Retrieves exchange rates for an array of cryptocurrency symbols.
Handles splitting the symbols into batches to comply with API limitations.
string[]
An array of cryptocurrency symbols (e.g., ['BTC', 'ETH']).
string = 'BTC'
The target currency symbol (default is 'BTC').
Promise<LiveCoinWatchMarket[]>
An array of LiveCoinWatchMarket objects containing exchange rate information.
const liveCoinWatch = LiveCoinWatch.getInstance();
const rates = await liveCoinWatch.getExchangeRates(['BTC', 'ETH'], 'USD');
console.log('Exchange Rates:', rates);
staticgetInstance():LiveCoinWatch
Defined in: src/services/providers/liveCoinWatch.ts:92
Returns the singleton instance of the LiveCoinWatch class.
LiveCoinWatch
The singleton instance of LiveCoinWatch.
const liveCoinWatch = LiveCoinWatch.getInstance();