refactor!: support RUB only (WealthLedger/main#55)
Filter non-RUB data at ingest, collapse per-currency collections into single RUB Money, drop currency from TbankPortfolioValuePoint, remove NON_RUB_ACTIVITY and screener currency filter. BREAKING CHANGE: per-currency API fields replaced with single RUB Money; stock screener currency param removed.
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
subtract,
|
||||
} from '#src/common/decimal';
|
||||
import { ISO_DATE_LENGTH, ISO_DATE_START } from '#src/common/time';
|
||||
import { decimal } from '#src/integrations/tbank/decimal';
|
||||
import { rubMoney } from '#src/integrations/tbank/decimal';
|
||||
|
||||
import { CandleService } from '../../application/candle.service';
|
||||
import {
|
||||
@@ -70,15 +70,8 @@ export function stockQuote(
|
||||
const { price: last, candle: previous, tradingStatus = null } = values;
|
||||
const share = values.instrument;
|
||||
const priceAt = timestamp(last?.time);
|
||||
const currency = share?.currency?.toUpperCase();
|
||||
const price =
|
||||
last?.price && currency
|
||||
? { currency, value: formatDecimal(decimal(last.price)) }
|
||||
: null;
|
||||
const previousPrice =
|
||||
previous?.close && currency
|
||||
? { currency, value: formatDecimal(decimal(previous.close)) }
|
||||
: null;
|
||||
const price = last?.price ? rubMoney({ ...last.price, currency: share?.currency }) : null;
|
||||
const previousPrice = previous?.close ? rubMoney({ ...previous.close, currency: share?.currency }) : null;
|
||||
const difference =
|
||||
price && previousPrice
|
||||
? subtract(
|
||||
@@ -93,8 +86,8 @@ export function stockQuote(
|
||||
previousCloseDate: timestamp(previous?.time)?.slice(ISO_DATE_START, ISO_DATE_LENGTH) ?? null,
|
||||
previousClose: previousPrice,
|
||||
change:
|
||||
difference && currency
|
||||
? { currency, value: formatDecimal(difference) }
|
||||
difference
|
||||
? { currency: 'RUB', value: formatDecimal(difference) }
|
||||
: null,
|
||||
changePercent:
|
||||
difference &&
|
||||
|
||||
Reference in New Issue
Block a user