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:
2026-11-11 08:22:16 +03:00
parent fee61537b6
commit 3b55b611b5
60 changed files with 624 additions and 736 deletions
@@ -68,7 +68,10 @@ function appendCashFlow(
missingAmountAccounts.add(operation.accountId);
return;
}
if (value.currency !== 'RUB') return;
if (value.currency !== 'RUB') {
missingAmountAccounts.add(operation.accountId);
return;
}
const amount = magnitude(value.value);
flows.push({
accountId: operation.accountId,
@@ -79,7 +82,6 @@ function appendCashFlow(
export function readPerformanceOperations(operations: Operation[]) {
const flows: PerformanceFlow[] = [];
const nonRubAccounts = new Set<string>();
const unvaluedAccounts = new Set<string>();
const missingAmountAccounts = new Set<string>();
for (const operation of operations) {
@@ -87,14 +89,13 @@ export function readPerformanceOperations(operations: Operation[]) {
if (typeof payload.type !== 'string') continue;
const value = money(payload.payment);
if (deposits.has(payload.type) || withdrawals.has(payload.type)) {
if (value && value.currency !== 'RUB') nonRubAccounts.add(operation.accountId);
appendCashFlow(operation, payload, value, flows, missingAmountAccounts);
} else if (securities.has(payload.type)) {
// Securities moved in or out carry no money amount for the flow.
unvaluedAccounts.add(operation.accountId);
}
}
return { flows, missingAmountAccounts, nonRubAccounts, unvaluedAccounts };
return { flows, missingAmountAccounts, unvaluedAccounts };
}
export function candidateTransfers(input: ReturnType<typeof readPerformanceOperations>): Candidate[] {