|
|
@ -146,7 +146,8 @@ export class PortfolioService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const valueInBaseCurrency = details.accounts[account.id]?.current ?? 0; |
|
|
|
const valueInBaseCurrency = |
|
|
|
details.accounts[account.id]?.valueInBaseCurrency ?? 0; |
|
|
|
|
|
|
|
const result = { |
|
|
|
...account, |
|
|
@ -615,8 +616,8 @@ export class PortfolioService { |
|
|
|
accounts[UNKNOWN_KEY] = { |
|
|
|
balance: 0, |
|
|
|
currency: userCurrency, |
|
|
|
current: emergencyFundInCash, |
|
|
|
name: UNKNOWN_KEY |
|
|
|
name: UNKNOWN_KEY, |
|
|
|
valueInBaseCurrency: emergencyFundInCash |
|
|
|
}; |
|
|
|
|
|
|
|
holdings[userCurrency] = { |
|
|
@ -1758,12 +1759,12 @@ export class PortfolioService { |
|
|
|
accounts[account.id] = { |
|
|
|
balance: account.balance, |
|
|
|
currency: account.currency, |
|
|
|
current: this.exchangeRateDataService.toCurrency( |
|
|
|
name: account.name, |
|
|
|
valueInBaseCurrency: this.exchangeRateDataService.toCurrency( |
|
|
|
account.balance, |
|
|
|
account.currency, |
|
|
|
userCurrency |
|
|
|
), |
|
|
|
name: account.name |
|
|
|
) |
|
|
|
}; |
|
|
|
|
|
|
|
for (const order of ordersByAccount) { |
|
|
@ -1777,15 +1778,15 @@ export class PortfolioService { |
|
|
|
currentValueOfSymbolInBaseCurrency *= -1; |
|
|
|
} |
|
|
|
|
|
|
|
if (accounts[order.Account?.id || UNKNOWN_KEY]?.current) { |
|
|
|
accounts[order.Account?.id || UNKNOWN_KEY].current += |
|
|
|
if (accounts[order.Account?.id || UNKNOWN_KEY]?.valueInBaseCurrency) { |
|
|
|
accounts[order.Account?.id || UNKNOWN_KEY].valueInBaseCurrency += |
|
|
|
currentValueOfSymbolInBaseCurrency; |
|
|
|
} else { |
|
|
|
accounts[order.Account?.id || UNKNOWN_KEY] = { |
|
|
|
balance: 0, |
|
|
|
currency: order.Account?.currency, |
|
|
|
current: currentValueOfSymbolInBaseCurrency, |
|
|
|
name: account.name |
|
|
|
name: account.name, |
|
|
|
valueInBaseCurrency: currentValueOfSymbolInBaseCurrency |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|