|
|
@ -59,6 +59,7 @@ import { |
|
|
InvestmentItem, |
|
|
InvestmentItem, |
|
|
PortfolioDetails, |
|
|
PortfolioDetails, |
|
|
PortfolioHoldingResponse, |
|
|
PortfolioHoldingResponse, |
|
|
|
|
|
PortfolioHoldingsResponse, |
|
|
PortfolioInvestmentsResponse, |
|
|
PortfolioInvestmentsResponse, |
|
|
PortfolioPerformanceResponse, |
|
|
PortfolioPerformanceResponse, |
|
|
PortfolioPosition, |
|
|
PortfolioPosition, |
|
|
@ -508,7 +509,14 @@ export class PortfolioService { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return holdings; |
|
|
return { |
|
|
|
|
|
holdings, |
|
|
|
|
|
totalValueInBaseCurrency: getSum( |
|
|
|
|
|
holdings.map(({ valueInBaseCurrency }) => { |
|
|
|
|
|
return new Big(valueInBaseCurrency ?? 0); |
|
|
|
|
|
}) |
|
|
|
|
|
).toNumber() |
|
|
|
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async getInvestments({ |
|
|
public async getInvestments({ |
|
|
@ -1241,7 +1249,7 @@ export class PortfolioService { |
|
|
subscriptionType: user.subscription?.type |
|
|
subscriptionType: user.subscription?.type |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const { errors, hasErrors, historicalData } = |
|
|
const { currentValueInBaseCurrency, errors, hasErrors, historicalData } = |
|
|
await portfolioCalculator.getSnapshot(); |
|
|
await portfolioCalculator.getSnapshot(); |
|
|
|
|
|
|
|
|
const { endDate, startDate } = getIntervalFromDateRange({ dateRange }); |
|
|
const { endDate, startDate } = getIntervalFromDateRange({ dateRange }); |
|
|
@ -1258,8 +1266,7 @@ export class PortfolioService { |
|
|
netPerformanceWithCurrencyEffect, |
|
|
netPerformanceWithCurrencyEffect, |
|
|
netWorth, |
|
|
netWorth, |
|
|
totalInvestment, |
|
|
totalInvestment, |
|
|
totalInvestmentValueWithCurrencyEffect, |
|
|
totalInvestmentValueWithCurrencyEffect |
|
|
valueWithCurrencyEffect |
|
|
|
|
|
} = chart?.at(-1) ?? { |
|
|
} = chart?.at(-1) ?? { |
|
|
netPerformance: 0, |
|
|
netPerformance: 0, |
|
|
netPerformanceInPercentage: 0, |
|
|
netPerformanceInPercentage: 0, |
|
|
@ -1267,7 +1274,7 @@ export class PortfolioService { |
|
|
netPerformanceWithCurrencyEffect: 0, |
|
|
netPerformanceWithCurrencyEffect: 0, |
|
|
netWorth: 0, |
|
|
netWorth: 0, |
|
|
totalInvestment: 0, |
|
|
totalInvestment: 0, |
|
|
valueWithCurrencyEffect: 0 |
|
|
totalInvestmentValueWithCurrencyEffect: 0 |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
@ -1281,7 +1288,7 @@ export class PortfolioService { |
|
|
totalInvestment, |
|
|
totalInvestment, |
|
|
totalInvestmentValueWithCurrencyEffect, |
|
|
totalInvestmentValueWithCurrencyEffect, |
|
|
currentNetWorth: netWorth, |
|
|
currentNetWorth: netWorth, |
|
|
currentValueInBaseCurrency: valueWithCurrencyEffect, |
|
|
currentValueInBaseCurrency: currentValueInBaseCurrency.toNumber(), |
|
|
netPerformancePercentage: netPerformanceInPercentage, |
|
|
netPerformancePercentage: netPerformanceInPercentage, |
|
|
netPerformancePercentageWithCurrencyEffect: |
|
|
netPerformancePercentageWithCurrencyEffect: |
|
|
netPerformanceInPercentageWithCurrencyEffect |
|
|
netPerformanceInPercentageWithCurrencyEffect |
|
|
|