|
|
@ -175,6 +175,10 @@ export class ActivitiesService { |
|
|
assetClass?: AssetClass; |
|
|
assetClass?: AssetClass; |
|
|
assetSubClass?: AssetSubClass; |
|
|
assetSubClass?: AssetSubClass; |
|
|
symbol?: string; |
|
|
symbol?: string; |
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
|
|
|
|
SymbolProfile: { |
|
|
|
|
|
connectOrCreate: Prisma.SymbolProfileCreateOrConnectWithoutActivitiesInput; |
|
|
|
|
|
}; |
|
|
tags?: { id: string }[]; |
|
|
tags?: { id: string }[]; |
|
|
updateAccountBalance?: boolean; |
|
|
updateAccountBalance?: boolean; |
|
|
userId: string; |
|
|
userId: string; |
|
|
@ -214,10 +218,6 @@ export class ActivitiesService { |
|
|
const connectOrCreateSymbolProfile = |
|
|
const connectOrCreateSymbolProfile = |
|
|
orderInput.SymbolProfile.connectOrCreate; |
|
|
orderInput.SymbolProfile.connectOrCreate; |
|
|
|
|
|
|
|
|
if (!connectOrCreateSymbolProfile) { |
|
|
|
|
|
throw new Error('SymbolProfile.connectOrCreate is required'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
if ( |
|
|
NON_INVESTMENT_ACTIVITY_TYPES.includes(orderInput.type) || |
|
|
NON_INVESTMENT_ACTIVITY_TYPES.includes(orderInput.type) || |
|
|
(connectOrCreateSymbolProfile.create.dataSource === 'MANUAL' && |
|
|
(connectOrCreateSymbolProfile.create.dataSource === 'MANUAL' && |
|
|
@ -513,9 +513,7 @@ export class ActivitiesService { |
|
|
const startOfUtcDateOfTomorrow = getStartOfUtcDateOfTomorrow(); |
|
|
const startOfUtcDateOfTomorrow = getStartOfUtcDateOfTomorrow(); |
|
|
|
|
|
|
|
|
for (const account of cashDetails.accounts) { |
|
|
for (const account of cashDetails.accounts) { |
|
|
if (!account.currency) { |
|
|
const accountCurrency = account.currency ?? userCurrency; |
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { balances } = await this.accountBalanceService.getAccountBalances({ |
|
|
const { balances } = await this.accountBalanceService.getAccountBalances({ |
|
|
userCurrency, |
|
|
userCurrency, |
|
|
@ -546,27 +544,27 @@ export class ActivitiesService { |
|
|
assetSubClass: AssetSubClass.CASH, |
|
|
assetSubClass: AssetSubClass.CASH, |
|
|
countries: [], |
|
|
countries: [], |
|
|
createdAt: new Date(balanceItem.date), |
|
|
createdAt: new Date(balanceItem.date), |
|
|
currency: account.currency, |
|
|
currency: accountCurrency, |
|
|
dataSource: |
|
|
dataSource: |
|
|
this.dataProviderService.getDataSourceForExchangeRates(), |
|
|
this.dataProviderService.getDataSourceForExchangeRates(), |
|
|
holdings: [], |
|
|
holdings: [], |
|
|
id: account.currency, |
|
|
id: accountCurrency, |
|
|
isActive: true, |
|
|
isActive: true, |
|
|
name: account.currency, |
|
|
name: accountCurrency, |
|
|
sectors: [], |
|
|
sectors: [], |
|
|
symbol: account.currency, |
|
|
symbol: accountCurrency, |
|
|
updatedAt: new Date(balanceItem.date) |
|
|
updatedAt: new Date(balanceItem.date) |
|
|
}, |
|
|
}, |
|
|
comment: account.name, |
|
|
comment: account.name, |
|
|
createdAt: new Date(balanceItem.date), |
|
|
createdAt: new Date(balanceItem.date), |
|
|
currency: account.currency, |
|
|
currency: accountCurrency, |
|
|
date: new Date(balanceItem.date), |
|
|
date: new Date(balanceItem.date), |
|
|
fee: 0, |
|
|
fee: 0, |
|
|
feeInAssetProfileCurrency: 0, |
|
|
feeInAssetProfileCurrency: 0, |
|
|
feeInBaseCurrency: 0, |
|
|
feeInBaseCurrency: 0, |
|
|
id: balanceItem.id, |
|
|
id: balanceItem.id, |
|
|
quantity: 1, |
|
|
quantity: 1, |
|
|
symbolProfileId: account.currency, |
|
|
symbolProfileId: accountCurrency, |
|
|
type: ActivityType.BUY, |
|
|
type: ActivityType.BUY, |
|
|
unitPrice: 1, |
|
|
unitPrice: 1, |
|
|
unitPriceInAssetProfileCurrency: 1, |
|
|
unitPriceInAssetProfileCurrency: 1, |
|
|
@ -936,7 +934,7 @@ export class ActivitiesService { |
|
|
assetSubClass?: AssetSubClass; |
|
|
assetSubClass?: AssetSubClass; |
|
|
symbol?: string; |
|
|
symbol?: string; |
|
|
tags?: { id: string }[]; |
|
|
tags?: { id: string }[]; |
|
|
type?: ActivityType; |
|
|
type: ActivityType; |
|
|
}; |
|
|
}; |
|
|
originalDate: Date; |
|
|
originalDate: Date; |
|
|
userId: string; |
|
|
userId: string; |
|
|
@ -959,7 +957,7 @@ export class ActivitiesService { |
|
|
let assetProfileCurrency: string | undefined; |
|
|
let assetProfileCurrency: string | undefined; |
|
|
|
|
|
|
|
|
if ( |
|
|
if ( |
|
|
(data.type && NON_INVESTMENT_ACTIVITY_TYPES.includes(data.type)) || |
|
|
NON_INVESTMENT_ACTIVITY_TYPES.includes(data.type) || |
|
|
(data.SymbolProfile?.connect?.dataSource_symbol?.dataSource === |
|
|
(data.SymbolProfile?.connect?.dataSource_symbol?.dataSource === |
|
|
'MANUAL' && |
|
|
'MANUAL' && |
|
|
data.type === 'BUY') |
|
|
data.type === 'BUY') |
|
|
|