Browse Source
			
			
			Feature/extend portfolio snapshot by activities count (#4352)
			
				* Extend portfolio snapshot by activities count
* Update changelog
			
			
				pull/4347/head^2
			
			
		 
		
			
				
					
						
						csehatt741
					
					8 months ago
					
						
							committed by
							
								
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: B5690EEEBB952194
						
					
				
			
		
		
		
	
		
			
				 4 changed files with 
7 additions and 
0 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
 
			
				- 
					
					
					 
					apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
				
 
			
				- 
					
					
					 
					apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
				
 
			
				- 
					
					
					 
					libs/common/src/lib/models/portfolio-snapshot.ts
				
 
			
		
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					### Added | 
					 | 
					 | 
					### Added | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					- Extended the export functionality by the tags | 
					 | 
					 | 
					- Extended the export functionality by the tags | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					- Extended the portfolio snapshot in the portfolio calculator by the activities count | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					- Extended the user endpoint `GET api/v1/user` by the activities count | 
					 | 
					 | 
					- Extended the user endpoint `GET api/v1/user` by the activities count | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					### Changed | 
					 | 
					 | 
					### Changed | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -175,6 +175,7 @@ export abstract class PortfolioCalculator { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    if (!transactionPoints.length) { | 
					 | 
					 | 
					    if (!transactionPoints.length) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      return { | 
					 | 
					 | 
					      return { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        activitiesCount: 0, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        currentValueInBaseCurrency: new Big(0), | 
					 | 
					 | 
					        currentValueInBaseCurrency: new Big(0), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        errors: [], | 
					 | 
					 | 
					        errors: [], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        hasErrors: false, | 
					 | 
					 | 
					        hasErrors: false, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -101,6 +101,9 @@ export class TWRPortfolioCalculator extends PortfolioCalculator { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      totalInterestWithCurrencyEffect, | 
					 | 
					 | 
					      totalInterestWithCurrencyEffect, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      totalInvestment, | 
					 | 
					 | 
					      totalInvestment, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      totalInvestmentWithCurrencyEffect, | 
					 | 
					 | 
					      totalInvestmentWithCurrencyEffect, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      activitiesCount: this.activities.filter(({ type }) => { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        return ['BUY', 'SELL'].includes(type); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      }).length, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      errors: [], | 
					 | 
					 | 
					      errors: [], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      historicalData: [], | 
					 | 
					 | 
					      historicalData: [], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      totalLiabilitiesWithCurrencyEffect: new Big(0), | 
					 | 
					 | 
					      totalLiabilitiesWithCurrencyEffect: new Big(0), | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  | 
				
			
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
		
			
				
					| 
						
						
							
								
							
						
						
					 | 
					@ -9,6 +9,8 @@ import { Big } from 'big.js'; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import { Transform, Type } from 'class-transformer'; | 
					 | 
					 | 
					import { Transform, Type } from 'class-transformer'; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					export class PortfolioSnapshot { | 
					 | 
					 | 
					export class PortfolioSnapshot { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					  activitiesCount: number; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  @Transform(transformToBig, { toClassOnly: true }) | 
					 | 
					 | 
					  @Transform(transformToBig, { toClassOnly: true }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  @Type(() => Big) | 
					 | 
					 | 
					  @Type(() => Big) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  currentValueInBaseCurrency: Big; | 
					 | 
					 | 
					  currentValueInBaseCurrency: Big; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |