Browse Source

Small fix

pull/2834/head
Reto Kaul 2 years ago
committed by Thomas Kaul
parent
commit
a416f9c269
  1. 18
      apps/api/src/app/portfolio/portfolio.service.ts

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

@ -482,7 +482,7 @@ export class PortfolioService {
continue; continue;
} }
const value = item.quantity.mul(item.marketPrice ?? 0); const value = item.quantity.mul(item.marketPriceInBaseCurrency ?? 0);
const symbolProfile = symbolProfileMap[item.symbol]; const symbolProfile = symbolProfileMap[item.symbol];
const dataProviderResponse = dataProviderResponses[item.symbol]; const dataProviderResponse = dataProviderResponses[item.symbol];
@ -1044,7 +1044,6 @@ export class PortfolioService {
averagePrice, averagePrice,
currency, currency,
dataSource, dataSource,
// fee,
firstBuyDate, firstBuyDate,
grossPerformance, grossPerformance,
grossPerformancePercentage, grossPerformancePercentage,
@ -1058,6 +1057,8 @@ export class PortfolioService {
netPerformanceWithCurrencyEffect, netPerformanceWithCurrencyEffect,
quantity, quantity,
symbol, symbol,
timeWeightedInvestment,
timeWeightedInvestmentWithCurrencyEffect,
transactionCount transactionCount
}) => { }) => {
return { return {
@ -1069,7 +1070,6 @@ export class PortfolioService {
assetClass: symbolProfileMap[symbol].assetClass, assetClass: symbolProfileMap[symbol].assetClass,
assetSubClass: symbolProfileMap[symbol].assetSubClass, assetSubClass: symbolProfileMap[symbol].assetSubClass,
averagePrice: averagePrice.toNumber(), averagePrice: averagePrice.toNumber(),
// fee: fee?.toNumber(),
grossPerformance: grossPerformance?.toNumber() ?? null, grossPerformance: grossPerformance?.toNumber() ?? null,
grossPerformancePercentage: grossPerformancePercentage:
grossPerformancePercentage?.toNumber() ?? null, grossPerformancePercentage?.toNumber() ?? null,
@ -1090,11 +1090,10 @@ export class PortfolioService {
netPerformancePercentageWithCurrencyEffect?.toNumber() ?? null, netPerformancePercentageWithCurrencyEffect?.toNumber() ?? null,
netPerformanceWithCurrencyEffect: netPerformanceWithCurrencyEffect:
netPerformanceWithCurrencyEffect?.toNumber() ?? null, netPerformanceWithCurrencyEffect?.toNumber() ?? null,
quantity: quantity.toNumber() quantity: quantity.toNumber(),
/*quantity: quantity?.toNumber(), timeWeightedInvestment: timeWeightedInvestment?.toNumber(),
timeWeightedInvestment: timeWeightedInvestment?.toNumber(), timeWeightedInvestmentWithCurrencyEffect:
timeWeightedInvestmentWithCurrencyEffect: timeWeightedInvestmentWithCurrencyEffect?.toNumber()
timeWeightedInvestmentWithCurrencyEffect?.toNumber()*/
}; };
} }
) )
@ -2072,7 +2071,8 @@ export class PortfolioService {
for (const order of ordersByAccount) { for (const order of ordersByAccount) {
let currentValueOfSymbolInBaseCurrency = let currentValueOfSymbolInBaseCurrency =
order.quantity * order.quantity *
(portfolioItemsNow[order.SymbolProfile.symbol]?.marketPrice ?? (portfolioItemsNow[order.SymbolProfile.symbol]
?.marketPriceInBaseCurrency ??
order.unitPrice ?? order.unitPrice ??
0); 0);

Loading…
Cancel
Save