@ -570,17 +570,10 @@ export class ImportService {
[ assetProfileIdentifier : string ] : Partial < SymbolProfile > ;
} = { } ;
const uniqueActivitiesDto = uniqBy (
activitiesDto ,
( { dataSource , symbol } ) = > {
return getAssetProfileIdentifier ( { dataSource , symbol } ) ;
}
) ;
for ( const [
index ,
{ currency , dataSource , symbol , type }
] of uniqueA ctivitiesDto. entries ( ) ) {
] of activitiesDto . entries ( ) ) {
if ( ! this . configurationService . get ( 'DATA_SOURCES' ) . includes ( dataSource ) ) {
throw new Error (
` activities. ${ index } .dataSource (" ${ dataSource } ") is not valid `
@ -602,6 +595,7 @@ export class ImportService {
}
}
if ( ! assetProfiles [ getAssetProfileIdentifier ( { dataSource , symbol } ) ] ) {
const assetProfile = {
currency ,
. . . (
@ -618,15 +612,9 @@ export class ImportService {
) ;
}
if (
assetProfile . currency !== currency &&
! this . exchangeRateDataService . hasCurrencyPair (
currency ,
assetProfile . currency
)
) {
if ( assetProfile . currency !== currency ) {
throw new Error (
` activities. ${ index } .currency (" ${ currency } ") does not match with "${ assetProfile . currency } " and no exchange rate is available from " ${ currency } " to "${ assetProfile . currency } " `
` activities. ${ index } .currency (" ${ currency } ") does not match with currency of ${ assetProfile . symbol } (" ${ assetProfile . currency } ") `
) ;
}
}
@ -634,6 +622,7 @@ export class ImportService {
assetProfiles [ getAssetProfileIdentifier ( { dataSource , symbol } ) ] =
assetProfile ;
}
}
return assetProfiles ;
}