| 
						
						
							
								
							
						
						
					 | 
					@ -45,6 +45,7 @@ export class ImportActivitiesService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    userAccounts: Account[]; | 
					 | 
					 | 
					    userAccounts: Account[]; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  }): Promise<{ | 
					 | 
					 | 
					  }): Promise<{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    activities: Activity[]; | 
					 | 
					 | 
					    activities: Activity[]; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    assetProfiles: CreateAssetProfileWithMarketDataDto[]; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  }> { | 
					 | 
					 | 
					  }> { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    const content = csvToJson(fileContent, { | 
					 | 
					 | 
					    const content = csvToJson(fileContent, { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      dynamicTyping: true, | 
					 | 
					 | 
					      dynamicTyping: true, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -53,23 +54,60 @@ export class ImportActivitiesService { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    }).data; | 
					 | 
					 | 
					    }).data; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    const activities: CreateOrderDto[] = []; | 
					 | 
					 | 
					    const activities: CreateOrderDto[] = []; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    const assetProfiles: CreateAssetProfileWithMarketDataDto[] = []; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    for (const [index, item] of content.entries()) { | 
					 | 
					 | 
					    for (const [index, item] of content.entries()) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      const dataSource = this.parseDataSource({ item }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      const symbol = this.parseSymbol({ content, index, item }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      const currency = this.parseCurrency({ content, index, item }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      activities.push({ | 
					 | 
					 | 
					      activities.push({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        accountId: this.parseAccount({ item, userAccounts }), | 
					 | 
					 | 
					        accountId: this.parseAccount({ item, userAccounts }), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        comment: this.parseComment({ item }), | 
					 | 
					 | 
					        comment: this.parseComment({ item }), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        currency: this.parseCurrency({ content, index, item }), | 
					 | 
					 | 
					        currency, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        dataSource: this.parseDataSource({ item }), | 
					 | 
					 | 
					        dataSource, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        date: this.parseDate({ content, index, item }), | 
					 | 
					 | 
					        date: this.parseDate({ content, index, item }), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        fee: this.parseFee({ content, index, item }), | 
					 | 
					 | 
					        fee: this.parseFee({ content, index, item }), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        quantity: this.parseQuantity({ content, index, item }), | 
					 | 
					 | 
					        quantity: this.parseQuantity({ content, index, item }), | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        symbol: this.parseSymbol({ content, index, item }), | 
					 | 
					 | 
					        symbol, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        type: this.parseType({ content, index, item }), | 
					 | 
					 | 
					        type: this.parseType({ content, index, item }), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        unitPrice: this.parseUnitPrice({ content, index, item }), | 
					 | 
					 | 
					        unitPrice: this.parseUnitPrice({ content, index, item }), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        updateAccountBalance: false | 
					 | 
					 | 
					        updateAccountBalance: false | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      }); | 
					 | 
					 | 
					      }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      // Create synthetic asset profile for MANUAL data source
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      if (dataSource === DataSource.MANUAL) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        assetProfiles.push({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          assetClass: null, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          assetSubClass: null, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          comment: null, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          countries: [], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          currency, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          cusip: null, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          dataSource: DataSource.MANUAL, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          figi: null, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          figiComposite: null, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          figiShareClass: null, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          holdings: [], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          isActive: true, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          isin: null, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          marketData: [], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          name: symbol, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          scraperConfiguration: null, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          sectors: [], | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          symbol, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          symbolMapping: {}, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					          url: null | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    return await this.importJson({ activities, isDryRun }); | 
					 | 
					 | 
					    const result = await this.importJson({ | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      activities, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      assetProfiles, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      isDryRun | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    }); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    return { ...result, assetProfiles }; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  } | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  public importJson({ | 
					 | 
					 | 
					  public importJson({ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |