Browse Source

Refactoring

pull/1643/head
Thomas 3 years ago
parent
commit
c1ef048129
  1. 2
      apps/api/src/app/portfolio/portfolio-calculator-baln-buy-and-sell.spec.ts
  2. 2
      apps/api/src/app/portfolio/portfolio-calculator-baln-buy.spec.ts
  3. 2
      apps/api/src/app/portfolio/portfolio-calculator-btcusd-buy-and-sell-partially.spec.ts
  4. 2
      apps/api/src/app/portfolio/portfolio-calculator-novn-buy-and-sell-partially.spec.ts
  5. 2
      apps/api/src/app/portfolio/portfolio-calculator-novn-buy-and-sell.spec.ts
  6. 2
      apps/api/src/app/portfolio/portfolio-calculator.ts
  7. 4
      apps/api/src/app/portfolio/portfolio.service.ts
  8. 2
      libs/common/src/lib/interfaces/timeline-position.interface.ts

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

@ -82,7 +82,7 @@ describe('PortfolioCalculator', () => {
averagePrice: new Big('0'),
currency: 'CHF',
dataSource: 'YAHOO',
fees: new Big('3.2'),
fee: new Big('3.2'),
firstBuyDate: '2021-11-22',
grossPerformance: new Big('-12.6'),
grossPerformancePercentage: new Big('-0.0440867739678096571'),

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

@ -71,7 +71,7 @@ describe('PortfolioCalculator', () => {
averagePrice: new Big('136.6'),
currency: 'CHF',
dataSource: 'YAHOO',
fees: new Big('1.55'),
fee: new Big('1.55'),
firstBuyDate: '2021-11-30',
grossPerformance: new Big('24.6'),
grossPerformancePercentage: new Big('0.09004392386530014641'),

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

@ -82,7 +82,7 @@ describe('PortfolioCalculator', () => {
averagePrice: new Big('320.43'),
currency: 'CHF',
dataSource: 'YAHOO',
fees: new Big('0'),
fee: new Big('0'),
firstBuyDate: '2015-01-01',
grossPerformance: new Big('27172.74'),
grossPerformancePercentage: new Big('42.40043067128546016291'),

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

@ -82,7 +82,7 @@ describe('PortfolioCalculator', () => {
averagePrice: new Big('75.80'),
currency: 'CHF',
dataSource: 'YAHOO',
fees: new Big('4.25'),
fee: new Big('4.25'),
firstBuyDate: '2022-03-07',
grossPerformance: new Big('21.93'),
grossPerformancePercentage: new Big('0.14465699208443271768'),

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

@ -102,7 +102,7 @@ describe('PortfolioCalculator', () => {
averagePrice: new Big('0'),
currency: 'CHF',
dataSource: 'YAHOO',
fees: new Big('0'),
fee: new Big('0'),
firstBuyDate: '2022-03-07',
grossPerformance: new Big('19.86'),
grossPerformancePercentage: new Big('0.13100263852242744063'),

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

@ -431,7 +431,7 @@ export class PortfolioCalculator {
: item.investment.div(item.quantity),
currency: item.currency,
dataSource: item.dataSource,
fees: item.fee,
fee: item.fee,
firstBuyDate: item.firstBuyDate,
grossPerformance: !hasErrors ? grossPerformance ?? null : null,
grossPerformancePercentage: !hasErrors

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

@ -746,7 +746,7 @@ export class PortfolioService {
averagePrice,
currency,
dataSource,
fees,
fee,
firstBuyDate,
marketPrice,
quantity,
@ -851,7 +851,7 @@ export class PortfolioService {
averagePrice: averagePrice.toNumber(),
dividendInBaseCurrency: dividendInBaseCurrency.toNumber(),
feeInBaseCurrency: this.exchangeRateDataService.toCurrency(
fees.toNumber(),
fee.toNumber(),
SymbolProfile.currency,
userCurrency
),

2
libs/common/src/lib/interfaces/timeline-position.interface.ts

@ -5,7 +5,7 @@ export interface TimelinePosition {
averagePrice: Big;
currency: string;
dataSource: DataSource;
fees: Big;
fee: Big;
firstBuyDate: string;
grossPerformance: Big;
grossPerformancePercentage: Big;

Loading…
Cancel
Save