|
@ -336,7 +336,6 @@ export class PortfolioService { |
|
|
dateRange = 'max', |
|
|
dateRange = 'max', |
|
|
filters, |
|
|
filters, |
|
|
impersonationId, |
|
|
impersonationId, |
|
|
pastInvestments, |
|
|
|
|
|
userId, |
|
|
userId, |
|
|
withExcludedAccounts = false, |
|
|
withExcludedAccounts = false, |
|
|
withLiabilities = false, |
|
|
withLiabilities = false, |
|
@ -345,7 +344,6 @@ export class PortfolioService { |
|
|
dateRange?: DateRange; |
|
|
dateRange?: DateRange; |
|
|
filters?: Filter[]; |
|
|
filters?: Filter[]; |
|
|
impersonationId: string; |
|
|
impersonationId: string; |
|
|
pastInvestments?: boolean; |
|
|
|
|
|
userId: string; |
|
|
userId: string; |
|
|
withExcludedAccounts?: boolean; |
|
|
withExcludedAccounts?: boolean; |
|
|
withLiabilities?: boolean; |
|
|
withLiabilities?: boolean; |
|
@ -401,8 +399,17 @@ export class PortfolioService { |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
const isFilteredByAccount = |
|
|
const isFilteredByAccount = |
|
|
filters?.some((filter) => { |
|
|
filters?.some(({ type }) => { |
|
|
return filter.type === 'ACCOUNT'; |
|
|
return type === 'ACCOUNT'; |
|
|
|
|
|
}) ?? false; |
|
|
|
|
|
|
|
|
|
|
|
const isFilteredByCash = filters?.some(({ id, type }) => { |
|
|
|
|
|
return id === 'CASH' && type === 'ASSET_CLASS'; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const isFilteredByQuantityEqualsZero = |
|
|
|
|
|
filters?.some(({ id, type }) => { |
|
|
|
|
|
return id === '0' && type === 'QUANTITY'; |
|
|
}) ?? false; |
|
|
}) ?? false; |
|
|
|
|
|
|
|
|
let filteredValueInBaseCurrency = isFilteredByAccount |
|
|
let filteredValueInBaseCurrency = isFilteredByAccount |
|
@ -454,7 +461,6 @@ export class PortfolioService { |
|
|
grossPerformancePercentageWithCurrencyEffect, |
|
|
grossPerformancePercentageWithCurrencyEffect, |
|
|
investment, |
|
|
investment, |
|
|
marketPrice, |
|
|
marketPrice, |
|
|
marketPriceInBaseCurrency, |
|
|
|
|
|
netPerformance, |
|
|
netPerformance, |
|
|
netPerformancePercentage, |
|
|
netPerformancePercentage, |
|
|
netPerformancePercentageWithCurrencyEffect, |
|
|
netPerformancePercentageWithCurrencyEffect, |
|
@ -465,12 +471,17 @@ export class PortfolioService { |
|
|
transactionCount, |
|
|
transactionCount, |
|
|
valueInBaseCurrency |
|
|
valueInBaseCurrency |
|
|
} of currentPositions.positions) { |
|
|
} of currentPositions.positions) { |
|
|
if (quantity.eq(0) && pastInvestments === false) { |
|
|
if (isFilteredByQuantityEqualsZero === true) { |
|
|
// Ignore positions without any quantity if past investments are not requested
|
|
|
if (!quantity.eq(0)) { |
|
|
|
|
|
// Ignore positions with a quantity
|
|
|
continue; |
|
|
continue; |
|
|
} else if (!quantity.eq(0) && pastInvestments === true) { |
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
if (quantity.eq(0)) { |
|
|
|
|
|
// Ignore positions without any quantity
|
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const symbolProfile = symbolProfileMap[symbol]; |
|
|
const symbolProfile = symbolProfileMap[symbol]; |
|
|
const dataProviderResponse = dataProviderResponses[symbol]; |
|
|
const dataProviderResponse = dataProviderResponses[symbol]; |
|
@ -584,10 +595,6 @@ export class PortfolioService { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const isFilteredByCash = filters?.some((filter) => { |
|
|
|
|
|
return filter.type === 'ASSET_CLASS' && filter.id === 'CASH'; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (filters?.length === 0 || isFilteredByAccount || isFilteredByCash) { |
|
|
if (filters?.length === 0 || isFilteredByAccount || isFilteredByCash) { |
|
|
const cashPositions = await this.getCashPositions({ |
|
|
const cashPositions = await this.getCashPositions({ |
|
|
cashDetails, |
|
|
cashDetails, |
|
|