UNPKG

@cygnus-wealth/asset-valuator

Version:

Asset valuation library for retrieving and converting cryptocurrency prices

18 lines (17 loc) 714 B
import { PriceProvider, AssetPrice, ConversionOptions } from './types.js'; export type Environment = 'production' | 'testnet' | 'local'; export declare class AssetValuator { private provider; private cache; private cacheTimeout; private environment; constructor(providerOrEnv?: PriceProvider | Environment, environment?: Environment); private selectProvider; private getCacheKey; private getCachedOrFetchPrice; getPrice(base: string, quote?: string): Promise<AssetPrice>; convert(options: ConversionOptions): Promise<number>; getPrices(symbols: string[], quote?: string): Promise<AssetPrice[]>; setCacheTimeout(milliseconds: number): void; clearCache(): void; }