Skip to content

Commit 3c53b29

Browse files
committed
Use USDT for historical NIM prices from CryptoCompare
By default, CryptoCompare calculates the NIM price in USD via BTC sats. But it doesn't use decimals for sats, so when the NIM price is 3 sats (rounded), then the historical prices follow Bitcoin's exactly. Using USDT as the target currency (vsCurrency) works because NIM has a direct pair with USDT on a major exchange, so CryptoCompare can use that directly.
1 parent 0bae7a5 commit 3c53b29

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/fiat-api/FiatApi.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,9 @@ export async function getHistoricExchangeRatesByRange<P extends Provider = Provi
577577
let providerHistoricRatesPromise: Promise<Array<[number, number]>>;
578578
switch (provider) {
579579
case Provider.CryptoCompare:
580+
if (cryptoCurrency === CryptoCurrency.NIM && vsCurrency === FiatCurrency.USD) {
581+
vsCurrency = CryptoCurrency.USDT;
582+
}
580583
providerHistoricRatesPromise = (async () => {
581584
let result: Array<[number, number]> = [];
582585
let batchToTs = to; // last timestamp to include in current batch; inclusive

0 commit comments

Comments
 (0)