|
@ -1830,12 +1830,12 @@ export class PortfolioService { |
|
|
userId: string; |
|
|
userId: string; |
|
|
withExcludedAccounts?: boolean; |
|
|
withExcludedAccounts?: boolean; |
|
|
}) { |
|
|
}) { |
|
|
const ordersOfTypeItem = await this.orderService.getOrders({ |
|
|
const ordersOfTypeItemOrLiability = await this.orderService.getOrders({ |
|
|
filters, |
|
|
filters, |
|
|
userCurrency, |
|
|
userCurrency, |
|
|
userId, |
|
|
userId, |
|
|
withExcludedAccounts, |
|
|
withExcludedAccounts, |
|
|
types: ['ITEM'] |
|
|
types: ['ITEM', 'LIABILITY'] |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const accounts: PortfolioDetails['accounts'] = {}; |
|
|
const accounts: PortfolioDetails['accounts'] = {}; |
|
@ -1875,13 +1875,14 @@ export class PortfolioService { |
|
|
return accountId === account.id; |
|
|
return accountId === account.id; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const ordersOfTypeItemByAccount = ordersOfTypeItem.filter( |
|
|
const ordersOfTypeItemOrLiabilityByAccount = |
|
|
({ accountId }) => { |
|
|
ordersOfTypeItemOrLiability.filter(({ accountId }) => { |
|
|
return accountId === account.id; |
|
|
return accountId === account.id; |
|
|
} |
|
|
}); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
ordersByAccount = ordersByAccount.concat(ordersOfTypeItemByAccount); |
|
|
ordersByAccount = ordersByAccount.concat( |
|
|
|
|
|
ordersOfTypeItemOrLiabilityByAccount |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
accounts[account.id] = { |
|
|
accounts[account.id] = { |
|
|
balance: account.balance, |
|
|
balance: account.balance, |
|
@ -1921,7 +1922,7 @@ export class PortfolioService { |
|
|
order.unitPrice ?? |
|
|
order.unitPrice ?? |
|
|
0); |
|
|
0); |
|
|
|
|
|
|
|
|
if (order.type === 'SELL') { |
|
|
if (order.type === 'LIABILITY' || order.type === 'SELL') { |
|
|
currentValueOfSymbolInBaseCurrency *= -1; |
|
|
currentValueOfSymbolInBaseCurrency *= -1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|