Browse Source

fix(exchange-rate): return aValue fallback when exchange rate data is missing

Fixes #6482

toCurrencyAtDate() previously returned undefined when no historical
exchange rate data was available for the requested date. This undefined
propagated into activity fields like feeInBaseCurrency and
valueInBaseCurrency, causing [big.js] Invalid number crashes on the
Overview, Portfolio, and Holdings pages.

Fix: log a warning and return the original aValue (1:1 fallback) instead
of undefined, preventing the crash while gracefully degrading.

Signed-off-by: Venkateswarlu Boggavarapu <mailtoboggavarapu@gmail.com>
pull/6751/head
mailtoboggavarapu-coder 2 days ago
parent
commit
8f6d66a34b
  1. 6
      apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts

6
apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts

@ -349,7 +349,11 @@ export class ExchangeRateDataService {
'ExchangeRateDataService'
);
return undefined;
Logger.warn(
`No exchange rate data found for ${aFromCurrency} -> ${aToCurrency} on ${aDate.toISOString()}, returning original value as fallback`,
'ExchangeRateDataService'
);
return aValue;
}
private async getExchangeRates({

Loading…
Cancel
Save