From 5bec2d34ebb8defd55381b75c0470c55d0c6b48e Mon Sep 17 00:00:00 2001 From: Daniel Padrino Date: Fri, 12 Jun 2026 12:47:08 -0300 Subject: [PATCH 1/2] fix(monitoring): remove delisted XT price-deviation checks XT delisted the DEURO/USDT, DEPS/USDT and JUSD/USDT pairs, so getPriceFrom(XT, ...) throws 'pair not supported' on every run. As the first call in getXtPriceDeviation(), it aborted the whole fetch() cron (Kraken/Binance volume never emitted) and logged ERROR every cycle. With all three XT pairs gone there is nothing left to monitor on XT, so remove getXtPriceDeviation() entirely along with the now-unused PricingService/AssetService injections and imports. Kraken and Binance volume reporting is unchanged and now always emits. --- .../monitoring/observers/exchange.observer.ts | 64 +------------------ 1 file changed, 1 insertion(+), 63 deletions(-) diff --git a/src/subdomains/core/monitoring/observers/exchange.observer.ts b/src/subdomains/core/monitoring/observers/exchange.observer.ts index e33abd6d04..20c0125c60 100644 --- a/src/subdomains/core/monitoring/observers/exchange.observer.ts +++ b/src/subdomains/core/monitoring/observers/exchange.observer.ts @@ -1,10 +1,7 @@ import { Injectable } from '@nestjs/common'; import { CronExpression } from '@nestjs/schedule'; -import { Blockchain } from 'src/integration/blockchain/shared/enums/blockchain.enum'; import { ExchangeTxType } from 'src/integration/exchange/entities/exchange-tx.entity'; import { ExchangeName } from 'src/integration/exchange/enums/exchange.enum'; -import { AssetType } from 'src/shared/models/asset/asset.entity'; -import { AssetService } from 'src/shared/models/asset/asset.service'; import { RepositoryFactory } from 'src/shared/repositories/repository.factory'; import { DfxLogger } from 'src/shared/services/dfx-logger'; import { DisabledProcess, Process } from 'src/shared/services/process.service'; @@ -12,12 +9,6 @@ import { DfxCron } from 'src/shared/utils/cron'; import { Util } from 'src/shared/utils/util'; import { MetricObserver } from 'src/subdomains/core/monitoring/metric.observer'; import { MonitoringService } from 'src/subdomains/core/monitoring/monitoring.service'; -import { PriceSource } from 'src/subdomains/supporting/pricing/domain/entities/price-rule.entity'; -import { - PriceCurrency, - PriceValidity, - PricingService, -} from 'src/subdomains/supporting/pricing/services/pricing.service'; import { MoreThan } from 'typeorm'; interface ExchangeData { @@ -25,21 +16,11 @@ interface ExchangeData { volume30: number; //volume of the last 30 days } -interface ExchangeDeviationData { - name: string; - deviation: number; // deviation of exchange pair to reference price -} - @Injectable() export class ExchangeObserver extends MetricObserver { protected readonly logger = new DfxLogger(ExchangeObserver); - constructor( - monitoringService: MonitoringService, - private readonly repos: RepositoryFactory, - private readonly pricingService: PricingService, - private readonly assetService: AssetService, - ) { + constructor(monitoringService: MonitoringService, private readonly repos: RepositoryFactory) { super(monitoringService, 'exchange', 'volume'); } @@ -50,7 +31,6 @@ export class ExchangeObserver extends MetricObserver { const data = []; data.push(await this.getKraken()); data.push(await this.getBinance()); - data.push(await this.getXtPriceDeviation()); this.emit(data); return data; @@ -58,48 +38,6 @@ export class ExchangeObserver extends MetricObserver { // *** HELPER METHODS *** // - private async getXtPriceDeviation(): Promise { - const [usdt, jusd] = await Promise.all([ - this.assetService.getAssetByQuery({ - name: 'USDT', - blockchain: Blockchain.ETHEREUM, - type: AssetType.TOKEN, - }), - await this.assetService.getAssetByQuery({ - name: 'JUSD', - blockchain: Blockchain.CITREA, - type: AssetType.TOKEN, - }), - ]); - - const xtDeurUsdtPrice = await this.pricingService.getPriceFrom(PriceSource.XT, 'USDT', 'DEURO'); - const xtDepsUsdtPrice = await this.pricingService.getPriceFrom(PriceSource.XT, 'USDT', 'DEPS'); - const xtJusdUsdtPrice = await this.pricingService.getPriceFrom(PriceSource.XT, 'USDT', 'JUSD'); - - const referenceDeurUsdtPrice = await this.pricingService.getPrice( - usdt, - PriceCurrency.EUR, - PriceValidity.VALID_ONLY, - ); - const referenceDepsUsdtPrice = await this.pricingService.getPriceFrom(PriceSource.DEURO, 'USDT', 'DEPS'); - const referenceJusdUsdtPrice = await this.pricingService.getPrice(usdt, jusd, PriceValidity.VALID_ONLY); - - return [ - { - name: 'XT-dEURO-USDT', - deviation: Util.round(xtDeurUsdtPrice.price / referenceDeurUsdtPrice.price - 1, 3), - }, - { - name: 'XT-DEPS-USDT', - deviation: Util.round(xtDepsUsdtPrice.price / referenceDepsUsdtPrice.price - 1, 3), - }, - { - name: 'XT-JUSD-USDT', - deviation: Util.round(xtJusdUsdtPrice.price / referenceJusdUsdtPrice.price - 1, 3), - }, - ]; - } - private async getKraken(): Promise { const volume30 = await this.getVolume30(ExchangeName.KRAKEN); return { From 4bb9d58c10d0bf37f8ebec863171c9d11057349a Mon Sep 17 00:00:00 2001 From: Daniel Padrino Date: Fri, 12 Jun 2026 12:55:51 -0300 Subject: [PATCH 2/2] style: fix prettier formatting in exchange.observer --- .../core/monitoring/observers/exchange.observer.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/subdomains/core/monitoring/observers/exchange.observer.ts b/src/subdomains/core/monitoring/observers/exchange.observer.ts index 20c0125c60..66ae0e7ff3 100644 --- a/src/subdomains/core/monitoring/observers/exchange.observer.ts +++ b/src/subdomains/core/monitoring/observers/exchange.observer.ts @@ -20,7 +20,10 @@ interface ExchangeData { export class ExchangeObserver extends MetricObserver { protected readonly logger = new DfxLogger(ExchangeObserver); - constructor(monitoringService: MonitoringService, private readonly repos: RepositoryFactory) { + constructor( + monitoringService: MonitoringService, + private readonly repos: RepositoryFactory, + ) { super(monitoringService, 'exchange', 'volume'); }