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: !hasErrors
? (netPerformancePercentage ?? null) ? (netPerformancePercentage ?? null)
: null, : null,
netPerformancePercentageWithCurrencyEffect: !hasErrors
? (netPerformancePercentageWithCurrencyEffectMap['max'] ?? null)
: null,
netPerformancePercentageWithCurrencyEffectMap: !hasErrors netPerformancePercentageWithCurrencyEffectMap: !hasErrors
? (netPerformancePercentageWithCurrencyEffectMap ?? null) ? (netPerformancePercentageWithCurrencyEffectMap ?? null)
: null, : null,
netPerformanceWithCurrencyEffect: !hasErrors
? (netPerformanceWithCurrencyEffect ?? null)
: null,
netPerformanceWithCurrencyEffectMap: !hasErrors netPerformanceWithCurrencyEffectMap: !hasErrors
? (netPerformanceWithCurrencyEffectMap ?? null) ? (netPerformanceWithCurrencyEffectMap ?? null)
: 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'), grossPerformanceWithCurrencyEffect: new Big('-12.6'),
investment: new Big('0'), investment: new Big('0'),
investmentWithCurrencyEffect: new Big('0'), investmentWithCurrencyEffect: new Big('0'),
netPerformance: new Big('-15.8'),
netPerformancePercentage: new Big('-0.05528341497550734703'),
netPerformancePercentageWithCurrencyEffect: new Big(
'-0.0552834149755073478'
),
netPerformancePercentageWithCurrencyEffectMap: { netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('-0.0552834149755073478') max: new Big('-0.0552834149755073478')
}, },
netPerformanceWithCurrencyEffect: new Big('-15.8'),
netPerformanceWithCurrencyEffectMap: { netPerformanceWithCurrencyEffectMap: {
max: new Big('-15.8') 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'), investmentWithCurrencyEffect: new Big('0'),
netPerformance: new Big('-15.8'), netPerformance: new Big('-15.8'),
netPerformancePercentage: new Big('-0.0552834149755073478'), netPerformancePercentage: new Big('-0.0552834149755073478'),
netPerformancePercentageWithCurrencyEffect: new Big(
'-0.0552834149755073478'
),
netPerformancePercentageWithCurrencyEffectMap: { netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('-0.0552834149755073478') max: new Big('-0.0552834149755073478')
}, },
netPerformanceWithCurrencyEffect: new Big('-15.8'),
netPerformanceWithCurrencyEffectMap: { netPerformanceWithCurrencyEffectMap: {
max: new Big('-15.8') 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'), investmentWithCurrencyEffect: new Big('273.2'),
netPerformance: new Big('23.05'), netPerformance: new Big('23.05'),
netPerformancePercentage: new Big('0.08437042459736456808'), netPerformancePercentage: new Big('0.08437042459736456808'),
netPerformancePercentageWithCurrencyEffect: new Big(
'0.08437042459736456808'
),
netPerformancePercentageWithCurrencyEffectMap: { netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('0.08437042459736456808') max: new Big('0.08437042459736456808')
}, },
netPerformanceWithCurrencyEffect: new Big('23.05'),
netPerformanceWithCurrencyEffectMap: { netPerformanceWithCurrencyEffectMap: {
'1d': new Big('10.00'), // 2 * (148.9 - 143.9) -> no fees in this time period '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 '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, marketPriceInBaseCurrency: 13298.425356,
netPerformance: new Big('27172.74').mul(0.97373), netPerformance: new Big('27172.74').mul(0.97373),
netPerformancePercentage: new Big('42.41983590271396609433'), netPerformancePercentage: new Big('42.41983590271396609433'),
netPerformancePercentageWithCurrencyEffect: new Big(
'41.64017412624815597854'
),
netPerformancePercentageWithCurrencyEffectMap: { netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('41.73453461766058626637') max: new Big('41.73453461766058626637')
}, },
netPerformanceWithCurrencyEffect: new Big(
'26516.208701400000064086'
),
netPerformanceWithCurrencyEffectMap: { netPerformanceWithCurrencyEffectMap: {
max: new Big('26516.208701400000064086') 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, marketPriceInBaseCurrency: 0,
netPerformance: null, netPerformance: null,
netPerformancePercentage: null, netPerformancePercentage: null,
netPerformancePercentageWithCurrencyEffect: null,
netPerformancePercentageWithCurrencyEffectMap: null, netPerformancePercentageWithCurrencyEffectMap: null,
netPerformanceWithCurrencyEffect: null,
netPerformanceWithCurrencyEffectMap: null, netPerformanceWithCurrencyEffectMap: null,
quantity: new Big('0'), quantity: new Big('0'),
symbol: '2c463fb3-af07-486e-adb0-8301b3d72141', 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'), investmentWithCurrencyEffect: new Big('82.329056'),
netPerformance: new Big('26.33').mul(0.8854), netPerformance: new Big('26.33').mul(0.8854),
netPerformancePercentage: new Big('0.29544434470377019749'), netPerformancePercentage: new Big('0.29544434470377019749'),
netPerformancePercentageWithCurrencyEffect: new Big(
'0.24112962014285697628'
),
netPerformancePercentageWithCurrencyEffectMap: { netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('0.24112962014285697628') max: new Big('0.24112962014285697628')
}, },
netPerformanceWithCurrencyEffect: new Big('19.851974'),
netPerformanceWithCurrencyEffectMap: { netPerformanceWithCurrencyEffectMap: {
max: new Big('19.851974') 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, marketPriceInBaseCurrency: 500000,
netPerformance: null, netPerformance: null,
netPerformancePercentage: null, netPerformancePercentage: null,
netPerformancePercentageWithCurrencyEffect: null,
netPerformancePercentageWithCurrencyEffectMap: null, netPerformancePercentageWithCurrencyEffectMap: null,
netPerformanceWithCurrencyEffect: null,
netPerformanceWithCurrencyEffectMap: null, netPerformanceWithCurrencyEffectMap: null,
quantity: new Big('0'), quantity: new Big('0'),
symbol: 'dac95060-d4f2-4653-a253-2c45e6fb5cde', 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'), investmentWithCurrencyEffect: new Big('75.80'),
netPerformance: new Big('17.68'), netPerformance: new Big('17.68'),
netPerformancePercentage: new Big('0.12184460284330327256'), netPerformancePercentage: new Big('0.12184460284330327256'),
netPerformancePercentageWithCurrencyEffect: new Big(
'0.12348284960422163588'
),
netPerformancePercentageWithCurrencyEffectMap: { netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('0.12348284960422163588') max: new Big('0.12348284960422163588')
}, },
netPerformanceWithCurrencyEffect: new Big('17.68'),
netPerformanceWithCurrencyEffectMap: { netPerformanceWithCurrencyEffectMap: {
max: new Big('17.68') 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'), investmentWithCurrencyEffect: new Big('0'),
netPerformance: new Big('19.86'), netPerformance: new Big('19.86'),
netPerformancePercentage: new Big('0.13100263852242744063'), netPerformancePercentage: new Big('0.13100263852242744063'),
netPerformancePercentageWithCurrencyEffect: new Big(
'0.13100263852242744063'
),
netPerformancePercentageWithCurrencyEffectMap: { netPerformancePercentageWithCurrencyEffectMap: {
max: new Big('0.13100263852242744063') max: new Big('0.13100263852242744063')
}, },
netPerformanceWithCurrencyEffect: new Big('19.86'),
netPerformanceWithCurrencyEffectMap: { netPerformanceWithCurrencyEffectMap: {
max: new Big('19.86') 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 =
netPerformanceWithCurrencyEffect.plus( netPerformanceWithCurrencyEffect.plus(
currentPosition.netPerformanceWithCurrencyEffect currentPosition.netPerformancePercentageWithCurrencyEffectMap['max']
); );
} else if (!currentPosition.quantity.eq(0)) { } else if (!currentPosition.quantity.eq(0)) {
hasErrors = true; hasErrors = true;

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

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

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

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

Loading…
Cancel
Save