refactor!: support RUB only (WealthLedger/main#55)
Backend verify / commits (pull_request) Successful in 1m38s
Backend verify / security (pull_request) Successful in 1m28s
Backend verify / verify (pull_request) Successful in 8m40s

Filter non-RUB data at ingest and collapse per-currency collections
into a single RUB Money. Drop currency from TbankPortfolioValuePoint,
remove NON_RUB_ACTIVITY and the screener currency filter.

BREAKING CHANGE: per-currency API fields replaced with single RUB Money.
This commit is contained in:
2026-11-11 09:40:25 +03:00
parent 85d65f8997
commit 83df5f0be6
61 changed files with 617 additions and 735 deletions
+17 -25
View File
@@ -218,32 +218,27 @@ describe('local accounts and portfolio HTTP (SQLite)', () => {
bondPositionCount: 0,
fundPositionCount: 0,
totalPositionCount: 1,
totalsByCurrency: [{ currency: 'RUB', value: '21.100000002' }],
cashBalances: [{ currency: 'RUB', value: '1.1' }],
totals: { currency: 'RUB', value: '21.100000002' },
cash: { currency: 'RUB', value: '1.1' },
structure: {
currencies: [{
currency: 'RUB',
totalValue: '21.100000002',
hasNegativeValues: false,
categories: [
{ type: 'STOCK', value: '20.000000002', sharePercent: '94.78673' },
{ type: 'BOND', value: '0', sharePercent: '0' },
{ type: 'OTHER', value: '0', sharePercent: '0' },
{ type: 'CASH', value: '1.1', sharePercent: '5.21327' },
],
}],
totalValue: '21.100000002',
hasNegativeValues: false,
categories: [
{ type: 'STOCK', value: '20.000000002', sharePercent: '94.78673' },
{ type: 'BOND', value: '0', sharePercent: '0' },
{ type: 'OTHER', value: '0', sharePercent: '0' },
{ type: 'CASH', value: '1.1', sharePercent: '5.21327' },
],
unvaluedCategories: [],
},
unrealizedReturnByCurrency: [
{ currency: 'RUB', absolute: '0', costBasis: '0', percent: null, partial: true },
],
unrealizedReturn: { absolute: '0', costBasis: '0', percent: null, partial: true },
});
const portfolio = await get('brokerage-accounts/account/portfolio').expect(
200,
);
expect(
(portfolio.body as PortfolioResourceDto).data?.totalsByCurrency,
).toEqual([{ currency: 'RUB', value: '21.100000002' }]);
(portfolio.body as PortfolioResourceDto).data?.totals,
).toEqual({ currency: 'RUB', value: '21.100000002' });
expect(upstream.getOpenAccounts).not.toHaveBeenCalled();
expect(upstream.getPortfolio).toHaveBeenCalledTimes(1);
expect(upstream.getInstrumentByFigi).not.toHaveBeenCalled();
@@ -315,7 +310,7 @@ describe('local accounts and portfolio HTTP (SQLite)', () => {
logoName: 'enriched.png',
quantity: '2',
});
expect(after.data?.totalsByCurrency).toEqual(before.data?.totalsByCurrency);
expect(after.data?.totals).toEqual(before.data?.totals);
expect(after.data?.lastSuccessfulAt).toBe(before.data?.lastSuccessfulAt);
expect(after.meta.dataRevision).not.toBe(before.meta.dataRevision);
expect(upstream.getPortfolio).toHaveBeenCalledTimes(1);
@@ -513,12 +508,9 @@ describe('local accounts and portfolio HTTP (SQLite)', () => {
const summaries = (await get('brokerage-accounts').expect(200))
.body as BrokerageAccountsResourceDto;
expect(summaries.data?.[0].portfolioSummary).toMatchObject({
totalsByCurrency: [{ currency: 'RUB', value: '21.1' }],
cashBalances: [{ currency: 'RUB', value: '1.1' }],
structure: { currencies: [{ currency: 'RUB' }] },
unrealizedReturnByCurrency: [
{ currency: 'RUB', absolute: '0', costBasis: '0', percent: null, partial: true },
],
totals: { currency: 'RUB', value: '21.1' },
cash: { currency: 'RUB', value: '1.1' },
unrealizedReturn: { absolute: '0', costBasis: '0', percent: null, partial: true },
stockPositionCount: 1,
bondPositionCount: 0,
fundPositionCount: 0,