| 
						
						
							
								
							
						
						
					 | 
					@ -462,8 +462,9 @@ export class PortfolioService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    const accounts = await this.getValueOfAccounts({ | 
					 | 
					 | 
					    const accounts = await this.getValueOfAccounts({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      orders, | 
					 | 
					 | 
					      orders, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      userId, | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      portfolioItemsNow, | 
					 | 
					 | 
					      portfolioItemsNow, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      userCurrency, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      userId, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      filters: aFilters | 
					 | 
					 | 
					      filters: aFilters | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    }); | 
					 | 
					 | 
					    }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -899,7 +900,8 @@ export class PortfolioService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    const accounts = await this.getValueOfAccounts({ | 
					 | 
					 | 
					    const accounts = await this.getValueOfAccounts({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      orders, | 
					 | 
					 | 
					      orders, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      portfolioItemsNow, | 
					 | 
					 | 
					      portfolioItemsNow, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					      userId | 
					 | 
					 | 
					      userId, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      userCurrency: currency | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    }); | 
					 | 
					 | 
					    }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    return { | 
					 | 
					 | 
					    return { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      rules: { | 
					 | 
					 | 
					      rules: { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -1268,11 +1270,13 @@ export class PortfolioService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    filters = [], | 
					 | 
					 | 
					    filters = [], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    orders, | 
					 | 
					 | 
					    orders, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    portfolioItemsNow, | 
					 | 
					 | 
					    portfolioItemsNow, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    userCurrency, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    userId | 
					 | 
					 | 
					    userId | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  }: { | 
					 | 
					 | 
					  }: { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    filters?: Filter[]; | 
					 | 
					 | 
					    filters?: Filter[]; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    orders: OrderWithAccount[]; | 
					 | 
					 | 
					    orders: OrderWithAccount[]; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    portfolioItemsNow: { [p: string]: TimelinePosition }; | 
					 | 
					 | 
					    portfolioItemsNow: { [p: string]: TimelinePosition }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    userCurrency: string; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    userId: string; | 
					 | 
					 | 
					    userId: string; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  }) { | 
					 | 
					 | 
					  }) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    const accounts: PortfolioDetails['accounts'] = {}; | 
					 | 
					 | 
					    const accounts: PortfolioDetails['accounts'] = {}; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -1301,34 +1305,47 @@ export class PortfolioService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      accounts[account.id] = { | 
					 | 
					 | 
					      accounts[account.id] = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        balance: account.balance, | 
					 | 
					 | 
					        balance: account.balance, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        currency: account.currency, | 
					 | 
					 | 
					        currency: account.currency, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        current: account.balance, | 
					 | 
					 | 
					        current: this.exchangeRateDataService.toCurrency( | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          account.balance, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          account.currency, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          userCurrency | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        ), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        name: account.name, | 
					 | 
					 | 
					        name: account.name, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        original: account.balance | 
					 | 
					 | 
					        original: this.exchangeRateDataService.toCurrency( | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          account.balance, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          account.currency, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          userCurrency | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        ) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      }; | 
					 | 
					 | 
					      }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      for (const order of ordersByAccount) { | 
					 | 
					 | 
					      for (const order of ordersByAccount) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        let currentValueOfSymbol = | 
					 | 
					 | 
					        let currentValueOfSymbolInBaseCurrency = | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					          order.quantity * | 
					 | 
					 | 
					          order.quantity * | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					          portfolioItemsNow[order.SymbolProfile.symbol].marketPrice; | 
					 | 
					 | 
					          portfolioItemsNow[order.SymbolProfile.symbol].marketPrice; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        let originalValueOfSymbol = order.quantity * order.unitPrice; | 
					 | 
					 | 
					        let originalValueOfSymbolInBaseCurrency = | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          this.exchangeRateDataService.toCurrency( | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            order.quantity * order.unitPrice, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            order.SymbolProfile.currency, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            userCurrency | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          ); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (order.type === 'SELL') { | 
					 | 
					 | 
					        if (order.type === 'SELL') { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					          currentValueOfSymbol *= -1; | 
					 | 
					 | 
					          currentValueOfSymbolInBaseCurrency *= -1; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					          originalValueOfSymbol *= -1; | 
					 | 
					 | 
					          originalValueOfSymbolInBaseCurrency *= -1; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (accounts[order.Account?.id || UNKNOWN_KEY]?.current) { | 
					 | 
					 | 
					        if (accounts[order.Account?.id || UNKNOWN_KEY]?.current) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					          accounts[order.Account?.id || UNKNOWN_KEY].current += | 
					 | 
					 | 
					          accounts[order.Account?.id || UNKNOWN_KEY].current += | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            currentValueOfSymbol; | 
					 | 
					 | 
					            currentValueOfSymbolInBaseCurrency; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					          accounts[order.Account?.id || UNKNOWN_KEY].original += | 
					 | 
					 | 
					          accounts[order.Account?.id || UNKNOWN_KEY].original += | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            originalValueOfSymbol; | 
					 | 
					 | 
					            originalValueOfSymbolInBaseCurrency; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					          accounts[order.Account?.id || UNKNOWN_KEY] = { | 
					 | 
					 | 
					          accounts[order.Account?.id || UNKNOWN_KEY] = { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            balance: 0, | 
					 | 
					 | 
					            balance: 0, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            currency: order.Account?.currency, | 
					 | 
					 | 
					            currency: order.Account?.currency, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            current: currentValueOfSymbol, | 
					 | 
					 | 
					            current: currentValueOfSymbolInBaseCurrency, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            name: account.name, | 
					 | 
					 | 
					            name: account.name, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            original: originalValueOfSymbol | 
					 | 
					 | 
					            original: originalValueOfSymbolInBaseCurrency | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					          }; | 
					 | 
					 | 
					          }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      } | 
					 | 
					 | 
					      } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |