diff --git a/backend/src/api/fiat-conversion.ts b/backend/src/api/fiat-conversion.ts index 954b5c606..89916c91d 100644 --- a/backend/src/api/fiat-conversion.ts +++ b/backend/src/api/fiat-conversion.ts @@ -2,10 +2,8 @@ import logger from '../logger'; import axios from 'axios'; class FiatConversion { - private tickers = { - 'BTCUSD': { - 'USD': 4110.78 - }, + private conversionRates = { + 'USD': 0 }; constructor() { } @@ -16,16 +14,19 @@ class FiatConversion { this.updateCurrency(); } - public getTickers() { - return this.tickers; + public getConversionRates() { + return this.conversionRates; } private async updateCurrency(): Promise { try { - const response = await axios.get('https://api.opennode.co/v1/rates'); - this.tickers = response.data.data; + const response = await axios.get('https://price.bisq.wiz.biz/getAllMarketPrices'); + const usd = response.data.data.find((item: any) => item.currencyCode === 'USD'); + this.conversionRates = { + 'USD': usd.price, + }; } catch (e) { - logger.err('Error updating currency from OpenNode: ' + e); + logger.err('Error updating fiat conversion rates: ' + e); } } } diff --git a/backend/src/api/websocket-handler.ts b/backend/src/api/websocket-handler.ts index b7f8b167e..76fb91583 100644 --- a/backend/src/api/websocket-handler.ts +++ b/backend/src/api/websocket-handler.ts @@ -126,7 +126,7 @@ class WebsocketHandler { 'vBytesPerSecond': memPool.getVBytesPerSecond(), 'lastDifficultyAdjustment': blocks.getLastDifficultyAdjustmentTime(), 'blocks': _blocks, - 'conversions': fiatConversion.getTickers()['BTCUSD'], + 'conversions': fiatConversion.getConversionRates(), 'mempool-blocks': mempoolBlocks.getMempoolBlocks(), 'transactions': memPool.getLatestTransactions(), 'git-commit': backendInfo.gitCommitHash,