Browse Source
			
			
			Feature/optimize portfolio calculations with smarter cloning of activities (#3827)
			
				* Optimize portfolio calculations with smarter cloning of activities
* Update changelog
			
			
				pull/3824/head^2
			
			
		 
		
			
				
					
						
						ceroma
					
					1 year ago
					
						
							committed by
							
								
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: B5690EEEBB952194
						
					
				
			
		
		
		
	
		
			
				 2 changed files with 
4 additions and 
3 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
 
			
				- 
					
					
					 
					apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					### Changed | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Optimized the portfolio calculations with smarter cloning of activities | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Integrated the add currency functionality into the market data section of the admin control panel | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Improved the language localization for German (`de`) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					- Upgraded `prisma` from version `5.19.1` to `5.20.0` | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -180,10 +180,10 @@ export class TWRPortfolioCalculator extends PortfolioCalculator { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    let valueAtStartDateWithCurrencyEffect: Big; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    // Clone orders to keep the original values in this.orders
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    let orders: PortfolioOrderItem[] = cloneDeep(this.activities).filter( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      ({ SymbolProfile }) => { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    let orders: PortfolioOrderItem[] = cloneDeep( | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      this.activities.filter(({ SymbolProfile }) => { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return SymbolProfile.symbol === symbol; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					      }) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    ); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    if (orders.length <= 0) { | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |