|
|
@ -857,28 +857,6 @@ export class ImportService { |
|
|
dataSource: activity.assetProfile.dataSource, |
|
|
dataSource: activity.assetProfile.dataSource, |
|
|
symbol: activity.assetProfile.symbol |
|
|
symbol: activity.assetProfile.symbol |
|
|
}; |
|
|
}; |
|
|
const { |
|
|
|
|
|
assetClass, |
|
|
|
|
|
assetSubClass, |
|
|
|
|
|
countries, |
|
|
|
|
|
createdAt, |
|
|
|
|
|
cusip, |
|
|
|
|
|
dataSource, |
|
|
|
|
|
figi, |
|
|
|
|
|
figiComposite, |
|
|
|
|
|
figiShareClass, |
|
|
|
|
|
holdings, |
|
|
|
|
|
id, |
|
|
|
|
|
isActive, |
|
|
|
|
|
isin, |
|
|
|
|
|
name, |
|
|
|
|
|
scraperConfiguration, |
|
|
|
|
|
sectors, |
|
|
|
|
|
symbol, |
|
|
|
|
|
symbolMapping, |
|
|
|
|
|
url, |
|
|
|
|
|
updatedAt |
|
|
|
|
|
} = assetProfile; |
|
|
|
|
|
const validatedAccount = accounts.find(({ id }) => { |
|
|
const validatedAccount = accounts.find(({ id }) => { |
|
|
return id === accountId; |
|
|
return id === accountId; |
|
|
}); |
|
|
}); |
|
|
@ -890,7 +868,7 @@ export class ImportService { |
|
|
|
|
|
|
|
|
let order: |
|
|
let order: |
|
|
| OrderWithAccount |
|
|
| OrderWithAccount |
|
|
| (Omit<OrderWithAccount, 'account' | 'tags'> & { |
|
|
| (Omit<OrderWithAccount, 'account' | 'SymbolProfile' | 'tags'> & { |
|
|
account?: { id: string; name: string }; |
|
|
account?: { id: string; name: string }; |
|
|
tags?: { id: string; name: string }[]; |
|
|
tags?: { id: string; name: string }[]; |
|
|
}); |
|
|
}); |
|
|
@ -916,33 +894,6 @@ export class ImportService { |
|
|
accountUserId: undefined, |
|
|
accountUserId: undefined, |
|
|
createdAt: new Date(), |
|
|
createdAt: new Date(), |
|
|
id: randomUUID(), |
|
|
id: randomUUID(), |
|
|
SymbolProfile: { |
|
|
|
|
|
assetClass, |
|
|
|
|
|
assetSubClass, |
|
|
|
|
|
countries, |
|
|
|
|
|
createdAt, |
|
|
|
|
|
cusip, |
|
|
|
|
|
dataSource, |
|
|
|
|
|
figi, |
|
|
|
|
|
figiComposite, |
|
|
|
|
|
figiShareClass, |
|
|
|
|
|
holdings, |
|
|
|
|
|
id, |
|
|
|
|
|
isActive, |
|
|
|
|
|
isin, |
|
|
|
|
|
name, |
|
|
|
|
|
scraperConfiguration, |
|
|
|
|
|
sectors, |
|
|
|
|
|
symbol, |
|
|
|
|
|
symbolMapping, |
|
|
|
|
|
updatedAt, |
|
|
|
|
|
url, |
|
|
|
|
|
comment: assetProfile.comment, |
|
|
|
|
|
currency: assetProfile.currency, |
|
|
|
|
|
dataGatheringFrequency: |
|
|
|
|
|
assetProfile.dataGatheringFrequency ?? 'DAILY', |
|
|
|
|
|
userId: dataSource === 'MANUAL' ? user.id : undefined |
|
|
|
|
|
}, |
|
|
|
|
|
symbolProfileId: undefined, |
|
|
symbolProfileId: undefined, |
|
|
tags: previewTags, |
|
|
tags: previewTags, |
|
|
updatedAt: new Date(), |
|
|
updatedAt: new Date(), |
|
|
@ -953,7 +904,9 @@ export class ImportService { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
order = await this.activitiesService.createActivity({ |
|
|
const { dataSource, name, symbol } = assetProfile; |
|
|
|
|
|
|
|
|
|
|
|
const createdActivity = await this.activitiesService.createActivity({ |
|
|
comment, |
|
|
comment, |
|
|
currency, |
|
|
currency, |
|
|
date, |
|
|
date, |
|
|
@ -987,10 +940,12 @@ export class ImportService { |
|
|
userId: user.id |
|
|
userId: user.id |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
if (order.SymbolProfile?.symbol) { |
|
|
if (createdActivity.SymbolProfile?.symbol) { |
|
|
// Update symbol that may have been assigned in createOrder()
|
|
|
// Update symbol that may have been assigned in createOrder()
|
|
|
assetProfile.symbol = order.SymbolProfile.symbol; |
|
|
assetProfile.symbol = createdActivity.SymbolProfile.symbol; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
order = createdActivity; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const value = new Big(quantity).mul(unitPrice).toNumber(); |
|
|
const value = new Big(quantity).mul(unitPrice).toNumber(); |
|
|
|