|
|
@ -179,9 +179,9 @@ export class PortfolioService { |
|
|
|
|
|
|
|
|
return Promise.all( |
|
|
return Promise.all( |
|
|
accounts.map(async (account) => { |
|
|
accounts.map(async (account) => { |
|
|
|
|
|
let activitiesCount = 0; |
|
|
let dividendInBaseCurrency = 0; |
|
|
let dividendInBaseCurrency = 0; |
|
|
let interestInBaseCurrency = 0; |
|
|
let interestInBaseCurrency = 0; |
|
|
let transactionCount = 0; |
|
|
|
|
|
|
|
|
|
|
|
for (const { |
|
|
for (const { |
|
|
currency, |
|
|
currency, |
|
|
@ -214,7 +214,7 @@ export class PortfolioService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!isDraft) { |
|
|
if (!isDraft) { |
|
|
transactionCount += 1; |
|
|
activitiesCount += 1; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -223,9 +223,9 @@ export class PortfolioService { |
|
|
|
|
|
|
|
|
const result = { |
|
|
const result = { |
|
|
...account, |
|
|
...account, |
|
|
|
|
|
activitiesCount, |
|
|
dividendInBaseCurrency, |
|
|
dividendInBaseCurrency, |
|
|
interestInBaseCurrency, |
|
|
interestInBaseCurrency, |
|
|
transactionCount, |
|
|
|
|
|
valueInBaseCurrency, |
|
|
valueInBaseCurrency, |
|
|
allocationInPercentage: 0, |
|
|
allocationInPercentage: 0, |
|
|
balanceInBaseCurrency: this.exchangeRateDataService.toCurrency( |
|
|
balanceInBaseCurrency: this.exchangeRateDataService.toCurrency( |
|
|
@ -233,6 +233,7 @@ export class PortfolioService { |
|
|
account.currency, |
|
|
account.currency, |
|
|
userCurrency |
|
|
userCurrency |
|
|
), |
|
|
), |
|
|
|
|
|
transactionCount: activitiesCount, |
|
|
value: this.exchangeRateDataService.toCurrency( |
|
|
value: this.exchangeRateDataService.toCurrency( |
|
|
valueInBaseCurrency, |
|
|
valueInBaseCurrency, |
|
|
userCurrency, |
|
|
userCurrency, |
|
|
@ -262,6 +263,8 @@ export class PortfolioService { |
|
|
withExcludedAccounts |
|
|
withExcludedAccounts |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
let activitiesCount = 0; |
|
|
|
|
|
|
|
|
const searchQuery = filters.find(({ type }) => { |
|
|
const searchQuery = filters.find(({ type }) => { |
|
|
return type === 'SEARCH_QUERY'; |
|
|
return type === 'SEARCH_QUERY'; |
|
|
})?.id; |
|
|
})?.id; |
|
|
@ -284,6 +287,8 @@ export class PortfolioService { |
|
|
let transactionCount = 0; |
|
|
let transactionCount = 0; |
|
|
|
|
|
|
|
|
for (const account of accounts) { |
|
|
for (const account of accounts) { |
|
|
|
|
|
activitiesCount += account.activitiesCount; |
|
|
|
|
|
|
|
|
totalBalanceInBaseCurrency = totalBalanceInBaseCurrency.plus( |
|
|
totalBalanceInBaseCurrency = totalBalanceInBaseCurrency.plus( |
|
|
account.balanceInBaseCurrency |
|
|
account.balanceInBaseCurrency |
|
|
); |
|
|
); |
|
|
@ -296,6 +301,7 @@ export class PortfolioService { |
|
|
totalValueInBaseCurrency = totalValueInBaseCurrency.plus( |
|
|
totalValueInBaseCurrency = totalValueInBaseCurrency.plus( |
|
|
account.valueInBaseCurrency |
|
|
account.valueInBaseCurrency |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
transactionCount += account.transactionCount; |
|
|
transactionCount += account.transactionCount; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -310,6 +316,7 @@ export class PortfolioService { |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
accounts, |
|
|
accounts, |
|
|
|
|
|
activitiesCount, |
|
|
transactionCount, |
|
|
transactionCount, |
|
|
totalBalanceInBaseCurrency: totalBalanceInBaseCurrency.toNumber(), |
|
|
totalBalanceInBaseCurrency: totalBalanceInBaseCurrency.toNumber(), |
|
|
totalDividendInBaseCurrency: totalDividendInBaseCurrency.toNumber(), |
|
|
totalDividendInBaseCurrency: totalDividendInBaseCurrency.toNumber(), |
|
|
@ -567,6 +574,7 @@ export class PortfolioService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for (const { |
|
|
for (const { |
|
|
|
|
|
activitiesCount, |
|
|
currency, |
|
|
currency, |
|
|
dividend, |
|
|
dividend, |
|
|
firstBuyDate, |
|
|
firstBuyDate, |
|
|
@ -610,6 +618,7 @@ export class PortfolioService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
holdings[symbol] = { |
|
|
holdings[symbol] = { |
|
|
|
|
|
activitiesCount, |
|
|
currency, |
|
|
currency, |
|
|
markets, |
|
|
markets, |
|
|
marketsAdvanced, |
|
|
marketsAdvanced, |
|
|
@ -789,6 +798,7 @@ export class PortfolioService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const { |
|
|
const { |
|
|
|
|
|
activitiesCount, |
|
|
averagePrice, |
|
|
averagePrice, |
|
|
currency, |
|
|
currency, |
|
|
dividendInBaseCurrency, |
|
|
dividendInBaseCurrency, |
|
|
@ -807,8 +817,7 @@ export class PortfolioService { |
|
|
quantity, |
|
|
quantity, |
|
|
tags, |
|
|
tags, |
|
|
timeWeightedInvestment, |
|
|
timeWeightedInvestment, |
|
|
timeWeightedInvestmentWithCurrencyEffect, |
|
|
timeWeightedInvestmentWithCurrencyEffect |
|
|
transactionCount |
|
|
|
|
|
} = holding; |
|
|
} = holding; |
|
|
|
|
|
|
|
|
const activitiesOfHolding = activities.filter(({ SymbolProfile }) => { |
|
|
const activitiesOfHolding = activities.filter(({ SymbolProfile }) => { |
|
|
@ -914,12 +923,12 @@ export class PortfolioService { |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
|
|
|
activitiesCount, |
|
|
marketPrice, |
|
|
marketPrice, |
|
|
marketPriceMax, |
|
|
marketPriceMax, |
|
|
marketPriceMin, |
|
|
marketPriceMin, |
|
|
SymbolProfile, |
|
|
SymbolProfile, |
|
|
tags, |
|
|
tags, |
|
|
activitiesCount: transactionCount, |
|
|
|
|
|
averagePrice: averagePrice.toNumber(), |
|
|
averagePrice: averagePrice.toNumber(), |
|
|
dataProviderInfo: portfolioCalculator.getDataProviderInfos()?.[0], |
|
|
dataProviderInfo: portfolioCalculator.getDataProviderInfos()?.[0], |
|
|
dateOfFirstActivity: firstBuyDate, |
|
|
dateOfFirstActivity: firstBuyDate, |
|
|
@ -1657,6 +1666,7 @@ export class PortfolioService { |
|
|
}): PortfolioPosition { |
|
|
}): PortfolioPosition { |
|
|
return { |
|
|
return { |
|
|
currency, |
|
|
currency, |
|
|
|
|
|
activitiesCount: 0, |
|
|
allocationInPercentage: 0, |
|
|
allocationInPercentage: 0, |
|
|
assetClass: AssetClass.LIQUIDITY, |
|
|
assetClass: AssetClass.LIQUIDITY, |
|
|
assetSubClass: AssetSubClass.CASH, |
|
|
assetSubClass: AssetSubClass.CASH, |
|
|
|