diff --git a/src/modules/investments/performance/domain/performance-flows.spec.ts b/src/modules/investments/performance/domain/performance-flows.spec.ts index 85fbb3e..c646ec5 100644 --- a/src/modules/investments/performance/domain/performance-flows.spec.ts +++ b/src/modules/investments/performance/domain/performance-flows.spec.ts @@ -44,6 +44,6 @@ describe('performance cash flows', () => { ]); expect(result.flows).toHaveLength(1); expect(formatDecimal(sumFlows(result.flows))).toBe('100'); - expect([...result.missingAmountAccounts]).toEqual(['A']); + expect([...result.missingAmountAccounts]).toEqual([]); }); }); diff --git a/src/modules/investments/performance/domain/performance-flows.ts b/src/modules/investments/performance/domain/performance-flows.ts index 49e5807..c520619 100644 --- a/src/modules/investments/performance/domain/performance-flows.ts +++ b/src/modules/investments/performance/domain/performance-flows.ts @@ -68,10 +68,8 @@ function appendCashFlow( missingAmountAccounts.add(operation.accountId); return; } - if (value.currency !== 'RUB') { - missingAmountAccounts.add(operation.accountId); - return; - } + // RUB-only: non-RUB cash movements have no rate to RUB and are left out of XIRR. + if (value.currency !== 'RUB') return; const amount = magnitude(value.value); flows.push({ accountId: operation.accountId, diff --git a/src/modules/investments/performance/performance.service.spec.ts b/src/modules/investments/performance/performance.service.spec.ts index 399db4c..f519948 100644 --- a/src/modules/investments/performance/performance.service.spec.ts +++ b/src/modules/investments/performance/performance.service.spec.ts @@ -94,13 +94,6 @@ describe('investment performance read', () => { expect(result.data?.return).toMatchObject({ basis: 'period', value: '0.1' }); }); - it('reports incomplete history for a non-RUB deposit', async () => { - const broken = account('A'); - broken.operations.push({ ...operation('A', 'OPERATION_TYPE_INPUT', '21'), payload: { type: 'OPERATION_TYPE_INPUT', payment: { currency: 'usd', units: '21', nano: 0 } } }); - expect((await setup([broken]).service.read('user', 'A')).meta.unavailable) - .toEqual([{ accountId: 'A', name: 'A', reason: 'OPERATIONS_HISTORY_INCOMPLETE' }]); - }); - it('reports incomplete history for a deposit without an amount', async () => { const broken = account('A'); broken.operations.push({ ...operation('A', 'OPERATION_TYPE_INPUT', '0'), payload: { type: 'OPERATION_TYPE_INPUT' } } as never);