Browse Source

Remove unused values

* netPerformancePercentageWithCurrencyEffect
* netPerformanceWithCurrencyEffect
pull/3393/head
Thomas Kaul 1 year ago
parent
commit
76ff7f7324
  1. 6
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
  2. 6
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-baln-buy-and-sell-in-two-activities.spec.ts
  3. 4
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-baln-buy-and-sell.spec.ts
  4. 4
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-baln-buy.spec.ts
  5. 6
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-btcusd-buy-and-sell-partially.spec.ts
  6. 2
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-fee.spec.ts
  7. 4
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-googl-buy.spec.ts
  8. 2
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-item.spec.ts
  9. 4
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-novn-buy-and-sell-partially.spec.ts
  10. 4
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-novn-buy-and-sell.spec.ts
  11. 2
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
  12. 19
      apps/api/src/app/portfolio/portfolio.service.ts
  13. 8
      libs/common/src/lib/models/timeline-position.ts

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

@ -394,15 +394,9 @@ export abstract class PortfolioCalculator {
netPerformancePercentage: !hasErrors
? (netPerformancePercentage ?? null)
: null,
netPerformancePercentageWithCurrencyEffect: !hasErrors
? (netPerformancePercentageWithCurrencyEffectMap['max'] ?? null)
: null,
netPerformancePercentageWithCurrencyEffectMap: !hasErrors
? (netPerformancePercentageWithCurrencyEffectMap ?? null)
: null,
netPerformanceWithCurrencyEffect: !hasErrors
? (netPerformanceWithCurrencyEffect ?? null)
: null,
netPerformanceWithCurrencyEffectMap: !hasErrors
? (netPerformanceWithCurrencyEffectMap ?? null)
: null,

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

@ -156,15 +156,9 @@ describe('PortfolioCalculator', () => {
grossPerformanceWithCurrencyEffect: new Big('-12.6'),
investment: new Big('0'),
investmentWithCurrencyEffect: new Big('0'),
netPerformance: new Big('-15.8'),
netPerformancePercentage: new Big('-0.05528341497550734703'),
netPerformancePercentageWithCurrencyEffect: new Big(
'-0.0552834149755073478'
),
netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('-0.0552834149755073478')
},
netPerformanceWithCurrencyEffect: new Big('-15.8'),
netPerformanceWithCurrencyEffectMap: {
max: new Big('-15.8')
},

4
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-baln-buy-and-sell.spec.ts

@ -143,13 +143,9 @@ describe('PortfolioCalculator', () => {
investmentWithCurrencyEffect: new Big('0'),
netPerformance: new Big('-15.8'),
netPerformancePercentage: new Big('-0.0552834149755073478'),
netPerformancePercentageWithCurrencyEffect: new Big(
'-0.0552834149755073478'
),
netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('-0.0552834149755073478')
},
netPerformanceWithCurrencyEffect: new Big('-15.8'),
netPerformanceWithCurrencyEffectMap: {
max: new Big('-15.8')
},

4
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-baln-buy.spec.ts

@ -128,13 +128,9 @@ describe('PortfolioCalculator', () => {
investmentWithCurrencyEffect: new Big('273.2'),
netPerformance: new Big('23.05'),
netPerformancePercentage: new Big('0.08437042459736456808'),
netPerformancePercentageWithCurrencyEffect: new Big(
'0.08437042459736456808'
),
netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('0.08437042459736456808')
},
netPerformanceWithCurrencyEffect: new Big('23.05'),
netPerformanceWithCurrencyEffectMap: {
'1d': new Big('10.00'), // 2 * (148.9 - 143.9) -> no fees in this time period
'1y': new Big('23.05'), // 2 * (148.9 - 136.6) - 1.55

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

@ -162,15 +162,9 @@ describe('PortfolioCalculator', () => {
marketPriceInBaseCurrency: 13298.425356,
netPerformance: new Big('27172.74').mul(0.97373),
netPerformancePercentage: new Big('42.41983590271396609433'),
netPerformancePercentageWithCurrencyEffect: new Big(
'41.64017412624815597854'
),
netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('41.73453461766058626637')
},
netPerformanceWithCurrencyEffect: new Big(
'26516.208701400000064086'
),
netPerformanceWithCurrencyEffectMap: {
max: new Big('26516.208701400000064086')
},

2
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-fee.spec.ts

@ -121,9 +121,7 @@ describe('PortfolioCalculator', () => {
marketPriceInBaseCurrency: 0,
netPerformance: null,
netPerformancePercentage: null,
netPerformancePercentageWithCurrencyEffect: null,
netPerformancePercentageWithCurrencyEffectMap: null,
netPerformanceWithCurrencyEffect: null,
netPerformanceWithCurrencyEffectMap: null,
quantity: new Big('0'),
symbol: '2c463fb3-af07-486e-adb0-8301b3d72141',

4
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-googl-buy.spec.ts

@ -141,13 +141,9 @@ describe('PortfolioCalculator', () => {
investmentWithCurrencyEffect: new Big('82.329056'),
netPerformance: new Big('26.33').mul(0.8854),
netPerformancePercentage: new Big('0.29544434470377019749'),
netPerformancePercentageWithCurrencyEffect: new Big(
'0.24112962014285697628'
),
netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('0.24112962014285697628')
},
netPerformanceWithCurrencyEffect: new Big('19.851974'),
netPerformanceWithCurrencyEffectMap: {
max: new Big('19.851974')
},

2
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-item.spec.ts

@ -121,9 +121,7 @@ describe('PortfolioCalculator', () => {
marketPriceInBaseCurrency: 500000,
netPerformance: null,
netPerformancePercentage: null,
netPerformancePercentageWithCurrencyEffect: null,
netPerformancePercentageWithCurrencyEffectMap: null,
netPerformanceWithCurrencyEffect: null,
netPerformanceWithCurrencyEffectMap: null,
quantity: new Big('0'),
symbol: 'dac95060-d4f2-4653-a253-2c45e6fb5cde',

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

@ -143,13 +143,9 @@ describe('PortfolioCalculator', () => {
investmentWithCurrencyEffect: new Big('75.80'),
netPerformance: new Big('17.68'),
netPerformancePercentage: new Big('0.12184460284330327256'),
netPerformancePercentageWithCurrencyEffect: new Big(
'0.12348284960422163588'
),
netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('0.12348284960422163588')
},
netPerformanceWithCurrencyEffect: new Big('17.68'),
netPerformanceWithCurrencyEffectMap: {
max: new Big('17.68')
},

4
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-novn-buy-and-sell.spec.ts

@ -192,13 +192,9 @@ describe('PortfolioCalculator', () => {
investmentWithCurrencyEffect: new Big('0'),
netPerformance: new Big('19.86'),
netPerformancePercentage: new Big('0.13100263852242744063'),
netPerformancePercentageWithCurrencyEffect: new Big(
'0.13100263852242744063'
),
netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('0.13100263852242744063')
},
netPerformanceWithCurrencyEffect: new Big('19.86'),
netPerformanceWithCurrencyEffectMap: {
max: new Big('19.86')
},

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

@ -79,7 +79,7 @@ export class TWRPortfolioCalculator extends PortfolioCalculator {
netPerformanceWithCurrencyEffect =
netPerformanceWithCurrencyEffect.plus(
currentPosition.netPerformanceWithCurrencyEffect
currentPosition.netPerformancePercentageWithCurrencyEffectMap['max']
);
} else if (!currentPosition.quantity.eq(0)) {
hasErrors = true;

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

@ -423,9 +423,7 @@ export class PortfolioService {
marketPrice,
netPerformance,
netPerformancePercentage,
netPerformancePercentageWithCurrencyEffect, // TODO: Remove?
netPerformancePercentageWithCurrencyEffectMap,
netPerformanceWithCurrencyEffect, // TODO: Remove?
netPerformanceWithCurrencyEffectMap,
quantity,
symbol,
@ -803,9 +801,11 @@ export class PortfolioService {
netPerformance: position.netPerformance?.toNumber(),
netPerformancePercent: position.netPerformancePercentage?.toNumber(),
netPerformancePercentWithCurrencyEffect:
position.netPerformancePercentageWithCurrencyEffect?.toNumber(),
position.netPerformancePercentageWithCurrencyEffectMap?.[
'max'
]?.toNumber(),
netPerformanceWithCurrencyEffect:
position.netPerformanceWithCurrencyEffect?.toNumber(),
position.netPerformanceWithCurrencyEffectMap?.['max']?.toNumber(),
quantity: quantity.toNumber(),
value: this.exchangeRateDataService.toCurrency(
quantity.mul(marketPrice ?? 0).toNumber(),
@ -986,8 +986,8 @@ export class PortfolioService {
investmentWithCurrencyEffect,
netPerformance,
netPerformancePercentage,
netPerformancePercentageWithCurrencyEffect,
netPerformanceWithCurrencyEffect,
netPerformancePercentageWithCurrencyEffectMap,
netPerformanceWithCurrencyEffectMap,
quantity,
symbol,
timeWeightedInvestment,
@ -1020,9 +1020,12 @@ export class PortfolioService {
netPerformancePercentage:
netPerformancePercentage?.toNumber() ?? null,
netPerformancePercentageWithCurrencyEffect:
netPerformancePercentageWithCurrencyEffect?.toNumber() ?? null,
netPerformancePercentageWithCurrencyEffectMap?.[
dateRange
]?.toNumber() ?? null,
netPerformanceWithCurrencyEffect:
netPerformanceWithCurrencyEffect?.toNumber() ?? null,
netPerformanceWithCurrencyEffectMap?.[dateRange]?.toNumber() ??
null,
quantity: quantity.toNumber(),
timeWeightedInvestment: timeWeightedInvestment?.toNumber(),
timeWeightedInvestmentWithCurrencyEffect:

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

@ -69,17 +69,9 @@ export class TimelinePosition {
@Type(() => Big)
netPerformancePercentage: Big;
@Transform(transformToBig, { toClassOnly: true })
@Type(() => Big)
netPerformancePercentageWithCurrencyEffect: Big;
@Transform(transformToMapOfBig, { toClassOnly: true })
netPerformancePercentageWithCurrencyEffectMap: { [key: DateRange]: Big };
@Transform(transformToBig, { toClassOnly: true })
@Type(() => Big)
netPerformanceWithCurrencyEffect: Big;
@Transform(transformToMapOfBig, { toClassOnly: true })
netPerformanceWithCurrencyEffectMap: { [key: DateRange]: Big };

Loading…
Cancel
Save