Browse Source

Task/remove deprecated transaction count in portfolio calculator and service (#6288)

* Remove deprecated transactionCount in portfolio calculator and service

* Update changelog
pull/6289/head^2
Thomas Kaul 2 days ago
committed by GitHub
parent
commit
63e75942a8
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      CHANGELOG.md
  2. 6
      apps/api/src/app/account/account.service.ts
  3. 7
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
  4. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy-and-buy.spec.ts
  5. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy-and-sell-in-two-activities.spec.ts
  6. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy-and-sell.spec.ts
  7. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy.spec.ts
  8. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btceur.spec.ts
  9. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btcusd-buy-and-sell-partially.spec.ts
  10. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btcusd.spec.ts
  11. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts
  12. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-googl-buy.spec.ts
  13. 3
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-msft-buy-with-dividend.spec.ts
  14. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-novn-buy-and-sell-partially.spec.ts
  15. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-novn-buy-and-sell.spec.ts
  16. 1
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-valuable.spec.ts
  17. 3
      apps/api/src/app/portfolio/interfaces/transaction-point-symbol.interface.ts
  18. 8
      apps/api/src/app/portfolio/portfolio.service.ts
  19. 48
      apps/api/src/helper/object.helper.spec.ts
  20. 6
      apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts
  21. 2
      apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html
  22. 4
      libs/common/src/lib/interfaces/portfolio-position.interface.ts
  23. 3
      libs/common/src/lib/interfaces/responses/accounts-response.interface.ts
  24. 3
      libs/common/src/lib/models/timeline-position.ts
  25. 4
      libs/common/src/lib/types/account-with-value.type.ts
  26. 6
      libs/ui/src/lib/accounts-table/accounts-table.component.html
  27. 6
      libs/ui/src/lib/accounts-table/accounts-table.component.stories.ts
  28. 7
      libs/ui/src/lib/mocks/holdings.ts

6
CHANGELOG.md

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Changed
- Removed the `transactionCount` in the portfolio calculator and service
## 2.236.0 - 2026-02-05 ## 2.236.0 - 2026-02-05
### Changed ### Changed

6
apps/api/src/app/account/account.service.ts

@ -150,15 +150,15 @@ export class AccountService {
}); });
return accounts.map((account) => { return accounts.map((account) => {
let transactionCount = 0; let activitiesCount = 0;
for (const { isDraft } of account.activities) { for (const { isDraft } of account.activities) {
if (!isDraft) { if (!isDraft) {
transactionCount += 1; activitiesCount += 1;
} }
} }
const result = { ...account, transactionCount }; const result = { ...account, activitiesCount };
delete result.activities; delete result.activities;

7
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts

@ -445,7 +445,6 @@ export abstract class PortfolioCalculator {
quantity: item.quantity, quantity: item.quantity,
symbol: item.symbol, symbol: item.symbol,
tags: item.tags, tags: item.tags,
transactionCount: item.transactionCount,
valueInBaseCurrency: new Big(marketPriceInBaseCurrency).mul( valueInBaseCurrency: new Big(marketPriceInBaseCurrency).mul(
item.quantity item.quantity
) )
@ -1005,8 +1004,7 @@ export abstract class PortfolioCalculator {
oldAccumulatedSymbol.feeInBaseCurrency.plus(feeInBaseCurrency), oldAccumulatedSymbol.feeInBaseCurrency.plus(feeInBaseCurrency),
includeInHoldings: oldAccumulatedSymbol.includeInHoldings, includeInHoldings: oldAccumulatedSymbol.includeInHoldings,
quantity: newQuantity, quantity: newQuantity,
tags: oldAccumulatedSymbol.tags.concat(tags), tags: oldAccumulatedSymbol.tags.concat(tags)
transactionCount: oldAccumulatedSymbol.transactionCount + 1
}; };
} else { } else {
currentTransactionPointItem = { currentTransactionPointItem = {
@ -1024,8 +1022,7 @@ export abstract class PortfolioCalculator {
dividend: new Big(0), dividend: new Big(0),
includeInHoldings: INVESTMENT_ACTIVITY_TYPES.includes(type), includeInHoldings: INVESTMENT_ACTIVITY_TYPES.includes(type),
investment: unitPrice.mul(quantity).mul(factor), investment: unitPrice.mul(quantity).mul(factor),
quantity: quantity.mul(factor), quantity: quantity.mul(factor)
transactionCount: 1
}; };
} }

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy-and-buy.spec.ts

@ -178,7 +178,6 @@ describe('PortfolioCalculator', () => {
timeWeightedInvestmentWithCurrencyEffect: new Big( timeWeightedInvestmentWithCurrencyEffect: new Big(
'474.93846153846153846154' '474.93846153846153846154'
), ),
transactionCount: 2,
valueInBaseCurrency: new Big('595.6') valueInBaseCurrency: new Big('595.6')
} }
], ],

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy-and-sell-in-two-activities.spec.ts

@ -192,7 +192,6 @@ describe('PortfolioCalculator', () => {
timeWeightedInvestmentWithCurrencyEffect: new Big( timeWeightedInvestmentWithCurrencyEffect: new Big(
'285.80000000000000396627' '285.80000000000000396627'
), ),
transactionCount: 3,
valueInBaseCurrency: new Big('0') valueInBaseCurrency: new Big('0')
} }
], ],

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy-and-sell.spec.ts

@ -176,7 +176,6 @@ describe('PortfolioCalculator', () => {
tags: [], tags: [],
timeWeightedInvestment: new Big('285.8'), timeWeightedInvestment: new Big('285.8'),
timeWeightedInvestmentWithCurrencyEffect: new Big('285.8'), timeWeightedInvestmentWithCurrencyEffect: new Big('285.8'),
transactionCount: 2,
valueInBaseCurrency: new Big('0') valueInBaseCurrency: new Big('0')
} }
], ],

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-baln-buy.spec.ts

@ -172,7 +172,6 @@ describe('PortfolioCalculator', () => {
tags: [], tags: [],
timeWeightedInvestment: new Big('273.2'), timeWeightedInvestment: new Big('273.2'),
timeWeightedInvestmentWithCurrencyEffect: new Big('273.2'), timeWeightedInvestmentWithCurrencyEffect: new Big('273.2'),
transactionCount: 1,
valueInBaseCurrency: new Big('297.8') valueInBaseCurrency: new Big('297.8')
} }
], ],

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btceur.spec.ts

@ -227,7 +227,6 @@ describe('PortfolioCalculator', () => {
tags: [], tags: [],
timeWeightedInvestment: new Big('44558.42'), timeWeightedInvestment: new Big('44558.42'),
timeWeightedInvestmentWithCurrencyEffect: new Big('44558.42'), timeWeightedInvestmentWithCurrencyEffect: new Big('44558.42'),
transactionCount: 1,
valueInBaseCurrency: new Big('43099.7') valueInBaseCurrency: new Big('43099.7')
} }
], ],

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btcusd-buy-and-sell-partially.spec.ts

@ -194,7 +194,6 @@ describe('PortfolioCalculator', () => {
timeWeightedInvestmentWithCurrencyEffect: new Big( timeWeightedInvestmentWithCurrencyEffect: new Big(
'636.79389574611155533947' '636.79389574611155533947'
), ),
transactionCount: 2,
valueInBaseCurrency: new Big('13298.425356') valueInBaseCurrency: new Big('13298.425356')
} }
], ],

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btcusd.spec.ts

@ -227,7 +227,6 @@ describe('PortfolioCalculator', () => {
tags: [], tags: [],
timeWeightedInvestment: new Big('44558.42'), timeWeightedInvestment: new Big('44558.42'),
timeWeightedInvestmentWithCurrencyEffect: new Big('44558.42'), timeWeightedInvestmentWithCurrencyEffect: new Big('44558.42'),
transactionCount: 1,
valueInBaseCurrency: new Big('43099.7') valueInBaseCurrency: new Big('43099.7')
} }
], ],

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-cash.spec.ts

@ -276,7 +276,6 @@ describe('PortfolioCalculator', () => {
timeWeightedInvestmentWithCurrencyEffect: new Big( timeWeightedInvestmentWithCurrencyEffect: new Big(
'852.45231607629427792916' '852.45231607629427792916'
), ),
transactionCount: 2,
valueInBaseCurrency: new Big(1820) valueInBaseCurrency: new Big(1820)
}); });

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-googl-buy.spec.ts

@ -172,7 +172,6 @@ describe('PortfolioCalculator', () => {
tags: [], tags: [],
timeWeightedInvestment: new Big('89.12').mul(0.8854), timeWeightedInvestment: new Big('89.12').mul(0.8854),
timeWeightedInvestmentWithCurrencyEffect: new Big('82.329056'), timeWeightedInvestmentWithCurrencyEffect: new Big('82.329056'),
transactionCount: 1,
valueInBaseCurrency: new Big('103.10483') valueInBaseCurrency: new Big('103.10483')
} }
], ],

3
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-msft-buy-with-dividend.spec.ts

@ -162,8 +162,7 @@ describe('PortfolioCalculator', () => {
}, },
quantity: new Big('1'), quantity: new Big('1'),
symbol: 'MSFT', symbol: 'MSFT',
tags: [], tags: []
transactionCount: 2
} }
], ],
totalFeesWithCurrencyEffect: new Big('19'), totalFeesWithCurrencyEffect: new Big('19'),

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-novn-buy-and-sell-partially.spec.ts

@ -174,7 +174,6 @@ describe('PortfolioCalculator', () => {
timeWeightedInvestmentWithCurrencyEffect: new Big( timeWeightedInvestmentWithCurrencyEffect: new Big(
'145.10285714285714285714' '145.10285714285714285714'
), ),
transactionCount: 2,
valueInBaseCurrency: new Big('87.8') valueInBaseCurrency: new Big('87.8')
} }
], ],

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-novn-buy-and-sell.spec.ts

@ -225,7 +225,6 @@ describe('PortfolioCalculator', () => {
tags: [], tags: [],
timeWeightedInvestment: new Big('151.6'), timeWeightedInvestment: new Big('151.6'),
timeWeightedInvestmentWithCurrencyEffect: new Big('151.6'), timeWeightedInvestmentWithCurrencyEffect: new Big('151.6'),
transactionCount: 2,
valueInBaseCurrency: new Big('0') valueInBaseCurrency: new Big('0')
} }
], ],

1
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-valuable.spec.ts

@ -146,7 +146,6 @@ describe('PortfolioCalculator', () => {
tags: [], tags: [],
timeWeightedInvestment: new Big('500000'), timeWeightedInvestment: new Big('500000'),
timeWeightedInvestmentWithCurrencyEffect: new Big('500000'), timeWeightedInvestmentWithCurrencyEffect: new Big('500000'),
transactionCount: 1,
valueInBaseCurrency: new Big('500000') valueInBaseCurrency: new Big('500000')
} }
], ],

3
apps/api/src/app/portfolio/interfaces/transaction-point-symbol.interface.ts

@ -17,7 +17,4 @@ export interface TransactionPointSymbol {
skipErrors: boolean; skipErrors: boolean;
symbol: string; symbol: string;
tags?: Tag[]; tags?: Tag[];
/** @deprecated use activitiesCount instead */
transactionCount: number;
} }

8
apps/api/src/app/portfolio/portfolio.service.ts

@ -233,7 +233,6 @@ export class PortfolioService {
account.currency, account.currency,
userCurrency userCurrency
), ),
transactionCount: activitiesCount,
value: this.exchangeRateDataService.toCurrency( value: this.exchangeRateDataService.toCurrency(
valueInBaseCurrency, valueInBaseCurrency,
userCurrency, userCurrency,
@ -284,7 +283,6 @@ export class PortfolioService {
let totalDividendInBaseCurrency = new Big(0); let totalDividendInBaseCurrency = new Big(0);
let totalInterestInBaseCurrency = new Big(0); let totalInterestInBaseCurrency = new Big(0);
let totalValueInBaseCurrency = new Big(0); let totalValueInBaseCurrency = new Big(0);
let transactionCount = 0;
for (const account of accounts) { for (const account of accounts) {
activitiesCount += account.activitiesCount; activitiesCount += account.activitiesCount;
@ -301,8 +299,6 @@ export class PortfolioService {
totalValueInBaseCurrency = totalValueInBaseCurrency.plus( totalValueInBaseCurrency = totalValueInBaseCurrency.plus(
account.valueInBaseCurrency account.valueInBaseCurrency
); );
transactionCount += account.transactionCount;
} }
for (const account of accounts) { for (const account of accounts) {
@ -317,7 +313,6 @@ export class PortfolioService {
return { return {
accounts, accounts,
activitiesCount, activitiesCount,
transactionCount,
totalBalanceInBaseCurrency: totalBalanceInBaseCurrency.toNumber(), totalBalanceInBaseCurrency: totalBalanceInBaseCurrency.toNumber(),
totalDividendInBaseCurrency: totalDividendInBaseCurrency.toNumber(), totalDividendInBaseCurrency: totalDividendInBaseCurrency.toNumber(),
totalInterestInBaseCurrency: totalInterestInBaseCurrency.toNumber(), totalInterestInBaseCurrency: totalInterestInBaseCurrency.toNumber(),
@ -591,7 +586,6 @@ export class PortfolioService {
quantity, quantity,
symbol, symbol,
tags, tags,
transactionCount,
valueInBaseCurrency valueInBaseCurrency
} of positions) { } of positions) {
if (isFilteredByClosedHoldings === true) { if (isFilteredByClosedHoldings === true) {
@ -625,7 +619,6 @@ export class PortfolioService {
marketPrice, marketPrice,
symbol, symbol,
tags, tags,
transactionCount,
allocationInPercentage: filteredValueInBaseCurrency.eq(0) allocationInPercentage: filteredValueInBaseCurrency.eq(0)
? 0 ? 0
: valueInBaseCurrency.div(filteredValueInBaseCurrency).toNumber(), : valueInBaseCurrency.div(filteredValueInBaseCurrency).toNumber(),
@ -1696,7 +1689,6 @@ export class PortfolioService {
sectors: [], sectors: [],
symbol: currency, symbol: currency,
tags: [], tags: [],
transactionCount: 0,
valueInBaseCurrency: balance valueInBaseCurrency: balance
}; };
} }

48
apps/api/src/helper/object.helper.spec.ts

@ -111,6 +111,7 @@ describe('redactAttributes', () => {
hasError: false, hasError: false,
holdings: { holdings: {
'AAPL.US': { 'AAPL.US': {
activitiesCount: 1,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -130,7 +131,6 @@ describe('redactAttributes', () => {
marketPrice: 220.79, marketPrice: 220.79,
symbol: 'AAPL.US', symbol: 'AAPL.US',
tags: [], tags: [],
transactionCount: 1,
allocationInPercentage: 0.044900865255793135, allocationInPercentage: 0.044900865255793135,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'STOCK', assetSubClass: 'STOCK',
@ -163,6 +163,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.0694356974830054 valueInPercentage: 0.0694356974830054
}, },
'ALV.DE': { 'ALV.DE': {
activitiesCount: 2,
currency: 'EUR', currency: 'EUR',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -182,7 +183,6 @@ describe('redactAttributes', () => {
marketPrice: 296.5, marketPrice: 296.5,
symbol: 'ALV.DE', symbol: 'ALV.DE',
tags: [], tags: [],
transactionCount: 2,
allocationInPercentage: 0.026912563036519527, allocationInPercentage: 0.026912563036519527,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'STOCK', assetSubClass: 'STOCK',
@ -210,6 +210,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.04161818652826481 valueInPercentage: 0.04161818652826481
}, },
AMZN: { AMZN: {
activitiesCount: 1,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -229,7 +230,6 @@ describe('redactAttributes', () => {
marketPrice: 187.99, marketPrice: 187.99,
symbol: 'AMZN', symbol: 'AMZN',
tags: [], tags: [],
transactionCount: 1,
allocationInPercentage: 0.07646101417126275, allocationInPercentage: 0.07646101417126275,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'STOCK', assetSubClass: 'STOCK',
@ -262,6 +262,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.11824101426541227 valueInPercentage: 0.11824101426541227
}, },
bitcoin: { bitcoin: {
activitiesCount: 1,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 36985.0332704, UNKNOWN: 36985.0332704,
@ -287,7 +288,6 @@ describe('redactAttributes', () => {
userId: null userId: null
} }
], ],
transactionCount: 1,
allocationInPercentage: 0.15042891393226654, allocationInPercentage: 0.15042891393226654,
assetClass: 'LIQUIDITY', assetClass: 'LIQUIDITY',
assetSubClass: 'CRYPTOCURRENCY', assetSubClass: 'CRYPTOCURRENCY',
@ -313,6 +313,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.232626620912395 valueInPercentage: 0.232626620912395
}, },
BONDORA_GO_AND_GROW: { BONDORA_GO_AND_GROW: {
activitiesCount: 5,
currency: 'EUR', currency: 'EUR',
markets: { markets: {
UNKNOWN: 2231.644722160232, UNKNOWN: 2231.644722160232,
@ -338,7 +339,6 @@ describe('redactAttributes', () => {
userId: null userId: null
} }
], ],
transactionCount: 5,
allocationInPercentage: 0.009076749759365777, allocationInPercentage: 0.009076749759365777,
assetClass: 'FIXED_INCOME', assetClass: 'FIXED_INCOME',
assetSubClass: 'BOND', assetSubClass: 'BOND',
@ -364,6 +364,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.014036487867880205 valueInPercentage: 0.014036487867880205
}, },
FRANKLY95P: { FRANKLY95P: {
activitiesCount: 6,
currency: 'CHF', currency: 'CHF',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -389,7 +390,6 @@ describe('redactAttributes', () => {
userId: null userId: null
} }
], ],
transactionCount: 6,
allocationInPercentage: 0.09095764645669335, allocationInPercentage: 0.09095764645669335,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'ETF', assetSubClass: 'ETF',
@ -488,6 +488,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.14065892911313693 valueInPercentage: 0.14065892911313693
}, },
MSFT: { MSFT: {
activitiesCount: 1,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -507,7 +508,6 @@ describe('redactAttributes', () => {
marketPrice: 428.02, marketPrice: 428.02,
symbol: 'MSFT', symbol: 'MSFT',
tags: [], tags: [],
transactionCount: 1,
allocationInPercentage: 0.05222646409742627, allocationInPercentage: 0.05222646409742627,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'STOCK', assetSubClass: 'STOCK',
@ -540,6 +540,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.08076416659271518 valueInPercentage: 0.08076416659271518
}, },
TSLA: { TSLA: {
activitiesCount: 1,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -559,7 +560,6 @@ describe('redactAttributes', () => {
marketPrice: 260.46, marketPrice: 260.46,
symbol: 'TSLA', symbol: 'TSLA',
tags: [], tags: [],
transactionCount: 1,
allocationInPercentage: 0.1589050142378352, allocationInPercentage: 0.1589050142378352,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'STOCK', assetSubClass: 'STOCK',
@ -592,6 +592,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.2457342510950259 valueInPercentage: 0.2457342510950259
}, },
VTI: { VTI: {
activitiesCount: 5,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -611,7 +612,6 @@ describe('redactAttributes', () => {
marketPrice: 282.05, marketPrice: 282.05,
symbol: 'VTI', symbol: 'VTI',
tags: [], tags: [],
transactionCount: 5,
allocationInPercentage: 0.057358979326040366, allocationInPercentage: 0.057358979326040366,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'ETF', assetSubClass: 'ETF',
@ -764,6 +764,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.08870120238725339 valueInPercentage: 0.08870120238725339
}, },
'VWRL.SW': { 'VWRL.SW': {
activitiesCount: 5,
currency: 'CHF', currency: 'CHF',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -783,7 +784,6 @@ describe('redactAttributes', () => {
marketPrice: 117.62, marketPrice: 117.62,
symbol: 'VWRL.SW', symbol: 'VWRL.SW',
tags: [], tags: [],
transactionCount: 5,
allocationInPercentage: 0.09386983901959013, allocationInPercentage: 0.09386983901959013,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'ETF', assetSubClass: 'ETF',
@ -1172,6 +1172,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.145162408515095 valueInPercentage: 0.145162408515095
}, },
'XDWD.DE': { 'XDWD.DE': {
activitiesCount: 1,
currency: 'EUR', currency: 'EUR',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -1191,7 +1192,6 @@ describe('redactAttributes', () => {
marketPrice: 105.72, marketPrice: 105.72,
symbol: 'XDWD.DE', symbol: 'XDWD.DE',
tags: [], tags: [],
transactionCount: 1,
allocationInPercentage: 0.03598477442100562, allocationInPercentage: 0.03598477442100562,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'ETF', assetSubClass: 'ETF',
@ -1450,6 +1450,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.055647656152211074 valueInPercentage: 0.055647656152211074
}, },
USD: { USD: {
activitiesCount: 0,
currency: 'USD', currency: 'USD',
allocationInPercentage: 0.20291717628620132, allocationInPercentage: 0.20291717628620132,
assetClass: 'LIQUIDITY', assetClass: 'LIQUIDITY',
@ -1472,7 +1473,6 @@ describe('redactAttributes', () => {
sectors: [], sectors: [],
symbol: 'USD', symbol: 'USD',
tags: [], tags: [],
transactionCount: 0,
valueInBaseCurrency: 49890, valueInBaseCurrency: 49890,
valueInPercentage: 0.3137956381563603 valueInPercentage: 0.3137956381563603
} }
@ -1615,6 +1615,7 @@ describe('redactAttributes', () => {
hasError: false, hasError: false,
holdings: { holdings: {
'AAPL.US': { 'AAPL.US': {
activitiesCount: 1,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -1634,7 +1635,6 @@ describe('redactAttributes', () => {
marketPrice: 220.79, marketPrice: 220.79,
symbol: 'AAPL.US', symbol: 'AAPL.US',
tags: [], tags: [],
transactionCount: 1,
allocationInPercentage: 0.044900865255793135, allocationInPercentage: 0.044900865255793135,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'STOCK', assetSubClass: 'STOCK',
@ -1667,6 +1667,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.0694356974830054 valueInPercentage: 0.0694356974830054
}, },
'ALV.DE': { 'ALV.DE': {
activitiesCount: 2,
currency: 'EUR', currency: 'EUR',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -1686,7 +1687,6 @@ describe('redactAttributes', () => {
marketPrice: 296.5, marketPrice: 296.5,
symbol: 'ALV.DE', symbol: 'ALV.DE',
tags: [], tags: [],
transactionCount: 2,
allocationInPercentage: 0.026912563036519527, allocationInPercentage: 0.026912563036519527,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'STOCK', assetSubClass: 'STOCK',
@ -1714,6 +1714,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.04161818652826481 valueInPercentage: 0.04161818652826481
}, },
AMZN: { AMZN: {
activitiesCount: 1,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -1733,7 +1734,6 @@ describe('redactAttributes', () => {
marketPrice: 187.99, marketPrice: 187.99,
symbol: 'AMZN', symbol: 'AMZN',
tags: [], tags: [],
transactionCount: 1,
allocationInPercentage: 0.07646101417126275, allocationInPercentage: 0.07646101417126275,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'STOCK', assetSubClass: 'STOCK',
@ -1766,6 +1766,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.11824101426541227 valueInPercentage: 0.11824101426541227
}, },
bitcoin: { bitcoin: {
activitiesCount: 1,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 36985.0332704, UNKNOWN: 36985.0332704,
@ -1791,7 +1792,6 @@ describe('redactAttributes', () => {
userId: null userId: null
} }
], ],
transactionCount: 1,
allocationInPercentage: 0.15042891393226654, allocationInPercentage: 0.15042891393226654,
assetClass: 'LIQUIDITY', assetClass: 'LIQUIDITY',
assetSubClass: 'CRYPTOCURRENCY', assetSubClass: 'CRYPTOCURRENCY',
@ -1817,6 +1817,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.232626620912395 valueInPercentage: 0.232626620912395
}, },
BONDORA_GO_AND_GROW: { BONDORA_GO_AND_GROW: {
activitiesCount: 5,
currency: 'EUR', currency: 'EUR',
markets: { markets: {
UNKNOWN: 2231.644722160232, UNKNOWN: 2231.644722160232,
@ -1842,7 +1843,6 @@ describe('redactAttributes', () => {
userId: null userId: null
} }
], ],
transactionCount: 5,
allocationInPercentage: 0.009076749759365777, allocationInPercentage: 0.009076749759365777,
assetClass: 'FIXED_INCOME', assetClass: 'FIXED_INCOME',
assetSubClass: 'BOND', assetSubClass: 'BOND',
@ -1868,6 +1868,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.014036487867880205 valueInPercentage: 0.014036487867880205
}, },
FRANKLY95P: { FRANKLY95P: {
activitiesCount: 6,
currency: 'CHF', currency: 'CHF',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -1893,7 +1894,6 @@ describe('redactAttributes', () => {
userId: null userId: null
} }
], ],
transactionCount: 6,
allocationInPercentage: 0.09095764645669335, allocationInPercentage: 0.09095764645669335,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'ETF', assetSubClass: 'ETF',
@ -1972,6 +1972,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.14065892911313693 valueInPercentage: 0.14065892911313693
}, },
MSFT: { MSFT: {
activitiesCount: 1,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -1991,7 +1992,6 @@ describe('redactAttributes', () => {
marketPrice: 428.02, marketPrice: 428.02,
symbol: 'MSFT', symbol: 'MSFT',
tags: [], tags: [],
transactionCount: 1,
allocationInPercentage: 0.05222646409742627, allocationInPercentage: 0.05222646409742627,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'STOCK', assetSubClass: 'STOCK',
@ -2024,6 +2024,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.08076416659271518 valueInPercentage: 0.08076416659271518
}, },
TSLA: { TSLA: {
activitiesCount: 1,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -2043,7 +2044,6 @@ describe('redactAttributes', () => {
marketPrice: 260.46, marketPrice: 260.46,
symbol: 'TSLA', symbol: 'TSLA',
tags: [], tags: [],
transactionCount: 1,
allocationInPercentage: 0.1589050142378352, allocationInPercentage: 0.1589050142378352,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'STOCK', assetSubClass: 'STOCK',
@ -2076,6 +2076,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.2457342510950259 valueInPercentage: 0.2457342510950259
}, },
VTI: { VTI: {
activitiesCount: 5,
currency: 'USD', currency: 'USD',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -2095,7 +2096,6 @@ describe('redactAttributes', () => {
marketPrice: 282.05, marketPrice: 282.05,
symbol: 'VTI', symbol: 'VTI',
tags: [], tags: [],
transactionCount: 5,
allocationInPercentage: 0.057358979326040366, allocationInPercentage: 0.057358979326040366,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'ETF', assetSubClass: 'ETF',
@ -2248,6 +2248,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.08870120238725339 valueInPercentage: 0.08870120238725339
}, },
'VWRL.SW': { 'VWRL.SW': {
activitiesCount: 5,
currency: 'CHF', currency: 'CHF',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -2267,7 +2268,6 @@ describe('redactAttributes', () => {
marketPrice: 117.62, marketPrice: 117.62,
symbol: 'VWRL.SW', symbol: 'VWRL.SW',
tags: [], tags: [],
transactionCount: 5,
allocationInPercentage: 0.09386983901959013, allocationInPercentage: 0.09386983901959013,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'ETF', assetSubClass: 'ETF',
@ -2648,6 +2648,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.145162408515095 valueInPercentage: 0.145162408515095
}, },
'XDWD.DE': { 'XDWD.DE': {
activitiesCount: 1,
currency: 'EUR', currency: 'EUR',
markets: { markets: {
UNKNOWN: 0, UNKNOWN: 0,
@ -2667,7 +2668,6 @@ describe('redactAttributes', () => {
marketPrice: 105.72, marketPrice: 105.72,
symbol: 'XDWD.DE', symbol: 'XDWD.DE',
tags: [], tags: [],
transactionCount: 1,
allocationInPercentage: 0.03598477442100562, allocationInPercentage: 0.03598477442100562,
assetClass: 'EQUITY', assetClass: 'EQUITY',
assetSubClass: 'ETF', assetSubClass: 'ETF',
@ -2926,6 +2926,7 @@ describe('redactAttributes', () => {
valueInPercentage: 0.055647656152211074 valueInPercentage: 0.055647656152211074
}, },
USD: { USD: {
activitiesCount: 0,
currency: 'USD', currency: 'USD',
allocationInPercentage: 0.20291717628620132, allocationInPercentage: 0.20291717628620132,
assetClass: 'LIQUIDITY', assetClass: 'LIQUIDITY',
@ -2948,7 +2949,6 @@ describe('redactAttributes', () => {
sectors: [], sectors: [],
symbol: 'USD', symbol: 'USD',
tags: [], tags: [],
transactionCount: 0,
valueInBaseCurrency: null, valueInBaseCurrency: null,
valueInPercentage: 0.3137956381563603 valueInPercentage: 0.3137956381563603
} }

6
apps/client/src/app/components/account-detail-dialog/account-detail-dialog.component.ts

@ -80,6 +80,7 @@ import { AccountDetailDialogParams } from './interfaces/interfaces';
export class GfAccountDetailDialogComponent implements OnDestroy, OnInit { export class GfAccountDetailDialogComponent implements OnDestroy, OnInit {
public accountBalances: AccountBalancesResponse['balances']; public accountBalances: AccountBalancesResponse['balances'];
public activities: OrderWithAccount[]; public activities: OrderWithAccount[];
public activitiesCount: number;
public balance: number; public balance: number;
public balancePrecision = 2; public balancePrecision = 2;
public currency: string; public currency: string;
@ -100,7 +101,6 @@ export class GfAccountDetailDialogComponent implements OnDestroy, OnInit {
public sortColumn = 'date'; public sortColumn = 'date';
public sortDirection: SortDirection = 'desc'; public sortDirection: SortDirection = 'desc';
public totalItems: number; public totalItems: number;
public transactionCount: number;
public user: User; public user: User;
public valueInBaseCurrency: number; public valueInBaseCurrency: number;
@ -215,16 +215,17 @@ export class GfAccountDetailDialogComponent implements OnDestroy, OnInit {
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe( .subscribe(
({ ({
activitiesCount,
balance, balance,
currency, currency,
dividendInBaseCurrency, dividendInBaseCurrency,
interestInBaseCurrency, interestInBaseCurrency,
name, name,
platform, platform,
transactionCount,
value, value,
valueInBaseCurrency valueInBaseCurrency
}) => { }) => {
this.activitiesCount = activitiesCount;
this.balance = balance; this.balance = balance;
if ( if (
@ -270,7 +271,6 @@ export class GfAccountDetailDialogComponent implements OnDestroy, OnInit {
this.name = name; this.name = name;
this.platformName = platform?.name ?? '-'; this.platformName = platform?.name ?? '-';
this.transactionCount = transactionCount;
this.valueInBaseCurrency = valueInBaseCurrency; this.valueInBaseCurrency = valueInBaseCurrency;
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();

2
apps/client/src/app/components/account-detail-dialog/account-detail-dialog.html

@ -82,7 +82,7 @@
> >
</div> </div>
<div class="col-6 mb-3"> <div class="col-6 mb-3">
<gf-value i18n size="medium" [value]="transactionCount" <gf-value i18n size="medium" [value]="activitiesCount"
>Activities</gf-value >Activities</gf-value
> >
</div> </div>

4
libs/common/src/lib/interfaces/portfolio-position.interface.ts

@ -39,10 +39,6 @@ export interface PortfolioPosition {
sectors: Sector[]; sectors: Sector[];
symbol: string; symbol: string;
tags?: Tag[]; tags?: Tag[];
/** @deprecated use activitiesCount instead */
transactionCount: number;
type?: string; type?: string;
url?: string; url?: string;
valueInBaseCurrency?: number; valueInBaseCurrency?: number;

3
libs/common/src/lib/interfaces/responses/accounts-response.interface.ts

@ -7,7 +7,4 @@ export interface AccountsResponse {
totalDividendInBaseCurrency: number; totalDividendInBaseCurrency: number;
totalInterestInBaseCurrency: number; totalInterestInBaseCurrency: number;
totalValueInBaseCurrency: number; totalValueInBaseCurrency: number;
/** @deprecated use activitiesCount instead */
transactionCount: number;
} }

3
libs/common/src/lib/models/timeline-position.ts

@ -93,9 +93,6 @@ export class TimelinePosition {
@Type(() => Big) @Type(() => Big)
timeWeightedInvestmentWithCurrencyEffect: Big; timeWeightedInvestmentWithCurrencyEffect: Big;
/** @deprecated use activitiesCount instead */
transactionCount: number;
@Transform(transformToBig, { toClassOnly: true }) @Transform(transformToBig, { toClassOnly: true })
@Type(() => Big) @Type(() => Big)
valueInBaseCurrency: Big; valueInBaseCurrency: Big;

4
libs/common/src/lib/types/account-with-value.type.ts

@ -7,10 +7,6 @@ export type AccountWithValue = AccountModel & {
dividendInBaseCurrency: number; dividendInBaseCurrency: number;
interestInBaseCurrency: number; interestInBaseCurrency: number;
platform?: Platform; platform?: Platform;
/** @deprecated use activitiesCount instead */
transactionCount: number;
value: number; value: number;
valueInBaseCurrency: number; valueInBaseCurrency: number;
}; };

6
libs/ui/src/lib/accounts-table/accounts-table.component.html

@ -120,13 +120,13 @@
*matHeaderCellDef *matHeaderCellDef
class="justify-content-end px-1" class="justify-content-end px-1"
mat-header-cell mat-header-cell
mat-sort-header="transactionCount" mat-sort-header="activitiesCount"
> >
<span class="d-block d-sm-none">#</span> <span class="d-block d-sm-none">#</span>
<span class="d-none d-sm-block" i18n>Activities</span> <span class="d-none d-sm-block" i18n>Activities</span>
</th> </th>
<td *matCellDef="let element" class="px-1 text-right" mat-cell> <td *matCellDef="let element" class="px-1 text-right" mat-cell>
{{ element.transactionCount }} {{ element.activitiesCount }}
</td> </td>
<td *matFooterCellDef class="px-1 text-right" mat-footer-cell> <td *matFooterCellDef class="px-1 text-right" mat-footer-cell>
{{ activitiesCount }} {{ activitiesCount }}
@ -323,7 +323,7 @@
<hr class="m-0" /> <hr class="m-0" />
<button <button
mat-menu-item mat-menu-item
[disabled]="element.transactionCount > 0" [disabled]="element.activitiesCount > 0"
(click)="onDeleteAccount(element.id)" (click)="onDeleteAccount(element.id)"
> >
<span class="align-items-center d-flex"> <span class="align-items-center d-flex">

6
libs/ui/src/lib/accounts-table/accounts-table.component.stories.ts

@ -16,6 +16,7 @@ import { GfAccountsTableComponent } from './accounts-table.component';
const accounts = [ const accounts = [
{ {
activitiesCount: 0,
allocationInPercentage: null, allocationInPercentage: null,
balance: 278, balance: 278,
balanceInBaseCurrency: 278, balanceInBaseCurrency: 278,
@ -31,13 +32,13 @@ const accounts = [
url: 'https://www.coinbase.com' url: 'https://www.coinbase.com'
}, },
platformId: '8dc24b88-bb92-4152-af25-fe6a31643e26', platformId: '8dc24b88-bb92-4152-af25-fe6a31643e26',
transactionCount: 0,
updatedAt: new Date('2025-06-01T06:52:49.063Z'), updatedAt: new Date('2025-06-01T06:52:49.063Z'),
userId: '081aa387-487d-4438-83a4-3060eb2a016e', userId: '081aa387-487d-4438-83a4-3060eb2a016e',
value: 278, value: 278,
valueInBaseCurrency: 278 valueInBaseCurrency: 278
}, },
{ {
activitiesCount: 0,
allocationInPercentage: null, allocationInPercentage: null,
balance: 12000, balance: 12000,
balanceInBaseCurrency: 12000, balanceInBaseCurrency: 12000,
@ -53,13 +54,13 @@ const accounts = [
url: 'https://www.jpmorgan.com' url: 'https://www.jpmorgan.com'
}, },
platformId: '43e8fcd1-5b79-4100-b678-d2229bd1660d', platformId: '43e8fcd1-5b79-4100-b678-d2229bd1660d',
transactionCount: 0,
updatedAt: new Date('2025-06-01T06:48:53.055Z'), updatedAt: new Date('2025-06-01T06:48:53.055Z'),
userId: '081aa387-487d-4438-83a4-3060eb2a016e', userId: '081aa387-487d-4438-83a4-3060eb2a016e',
value: 12000, value: 12000,
valueInBaseCurrency: 12000 valueInBaseCurrency: 12000
}, },
{ {
activitiesCount: 12,
allocationInPercentage: null, allocationInPercentage: null,
balance: 150.2, balance: 150.2,
balanceInBaseCurrency: 150.2, balanceInBaseCurrency: 150.2,
@ -75,7 +76,6 @@ const accounts = [
url: 'https://interactivebrokers.com' url: 'https://interactivebrokers.com'
}, },
platformId: '9da3a8a7-4795-43e3-a6db-ccb914189737', platformId: '9da3a8a7-4795-43e3-a6db-ccb914189737',
transactionCount: 12,
valueInBaseCurrency: 95693.70321466809, valueInBaseCurrency: 95693.70321466809,
updatedAt: new Date('2025-06-01T06:53:10.569Z'), updatedAt: new Date('2025-06-01T06:53:10.569Z'),
userId: '081aa387-487d-4438-83a4-3060eb2a016e', userId: '081aa387-487d-4438-83a4-3060eb2a016e',

7
libs/ui/src/lib/mocks/holdings.ts

@ -41,7 +41,6 @@ export const holdings: PortfolioPosition[] = [
], ],
symbol: 'AAPL', symbol: 'AAPL',
tags: [], tags: [],
transactionCount: 1,
url: 'https://www.apple.com', url: 'https://www.apple.com',
valueInBaseCurrency: 12230 valueInBaseCurrency: 12230
}, },
@ -85,7 +84,6 @@ export const holdings: PortfolioPosition[] = [
], ],
symbol: 'ALV.DE', symbol: 'ALV.DE',
tags: [], tags: [],
transactionCount: 2,
url: 'https://www.allianz.com', url: 'https://www.allianz.com',
valueInBaseCurrency: 6763.224181360202 valueInBaseCurrency: 6763.224181360202
}, },
@ -129,7 +127,6 @@ export const holdings: PortfolioPosition[] = [
], ],
symbol: 'AMZN', symbol: 'AMZN',
tags: [], tags: [],
transactionCount: 1,
url: 'https://www.aboutamazon.com', url: 'https://www.aboutamazon.com',
valueInBaseCurrency: 22868 valueInBaseCurrency: 22868
}, },
@ -161,7 +158,6 @@ export const holdings: PortfolioPosition[] = [
sectors: [], sectors: [],
symbol: 'bitcoin', symbol: 'bitcoin',
tags: [], tags: [],
transactionCount: 1,
url: null, url: null,
valueInBaseCurrency: 54666.7898248 valueInBaseCurrency: 54666.7898248
}, },
@ -205,7 +201,6 @@ export const holdings: PortfolioPosition[] = [
], ],
symbol: 'MSFT', symbol: 'MSFT',
tags: [], tags: [],
transactionCount: 1,
url: 'https://www.microsoft.com', url: 'https://www.microsoft.com',
valueInBaseCurrency: 12252.9 valueInBaseCurrency: 12252.9
}, },
@ -249,7 +244,6 @@ export const holdings: PortfolioPosition[] = [
], ],
symbol: 'TSLA', symbol: 'TSLA',
tags: [], tags: [],
transactionCount: 1,
url: 'https://www.tesla.com', url: 'https://www.tesla.com',
valueInBaseCurrency: 53376 valueInBaseCurrency: 53376
}, },
@ -293,7 +287,6 @@ export const holdings: PortfolioPosition[] = [
], ],
symbol: 'VTI', symbol: 'VTI',
tags: [], tags: [],
transactionCount: 5,
url: 'https://www.vanguard.com', url: 'https://www.vanguard.com',
valueInBaseCurrency: 15092 valueInBaseCurrency: 15092
} }

Loading…
Cancel
Save