Browse Source

Feature/extend portfolio snapshot by activities count (#4352)

* Extend portfolio snapshot by activities count

* Update changelog
pull/4347/head^2
csehatt741 4 weeks ago
committed by GitHub
parent
commit
634bdf16d6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 1
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
  3. 3
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
  4. 2
      libs/common/src/lib/models/portfolio-snapshot.ts

1
CHANGELOG.md

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Extended the export functionality by the tags
- Extended the portfolio snapshot in the portfolio calculator by the activities count
- Extended the user endpoint `GET api/v1/user` by the activities count
### Changed

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

@ -175,6 +175,7 @@ export abstract class PortfolioCalculator {
if (!transactionPoints.length) {
return {
activitiesCount: 0,
currentValueInBaseCurrency: new Big(0),
errors: [],
hasErrors: false,

3
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts

@ -101,6 +101,9 @@ export class TWRPortfolioCalculator extends PortfolioCalculator {
totalInterestWithCurrencyEffect,
totalInvestment,
totalInvestmentWithCurrencyEffect,
activitiesCount: this.activities.filter(({ type }) => {
return ['BUY', 'SELL'].includes(type);
}).length,
errors: [],
historicalData: [],
totalLiabilitiesWithCurrencyEffect: new Big(0),

2
libs/common/src/lib/models/portfolio-snapshot.ts

@ -9,6 +9,8 @@ import { Big } from 'big.js';
import { Transform, Type } from 'class-transformer';
export class PortfolioSnapshot {
activitiesCount: number;
@Transform(transformToBig, { toClassOnly: true })
@Type(() => Big)
currentValueInBaseCurrency: Big;

Loading…
Cancel
Save