Browse Source
Bugfix/readd value in base currency to activity (#3078)
* Readd valueInBaseCurrency
* Update changelog
pull/3079/head^2
Thomas Kaul
11 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
23 additions and
21 deletions
-
CHANGELOG.md
-
apps/api/src/app/order/interfaces/activities.interface.ts
-
apps/api/src/app/order/order.service.ts
-
apps/api/src/app/portfolio/portfolio.service.ts
|
|
@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
- Improved the usability of the benchmarks in the markets overview |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Fixed a missing value in the activities table on mobile |
|
|
|
|
|
|
|
## 2.59.0 - 2024-02-29 |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
@ -7,8 +7,10 @@ export interface Activities { |
|
|
|
|
|
|
|
export interface Activity extends OrderWithAccount { |
|
|
|
error?: ActivityError; |
|
|
|
feeInBaseCurrency: number; |
|
|
|
updateAccountBalance?: boolean; |
|
|
|
value: number; |
|
|
|
valueInBaseCurrency: number; |
|
|
|
} |
|
|
|
|
|
|
|
export interface ActivityError { |
|
|
|
|
|
@ -328,7 +328,17 @@ export class OrderService { |
|
|
|
|
|
|
|
return { |
|
|
|
...order, |
|
|
|
value |
|
|
|
value, |
|
|
|
feeInBaseCurrency: this.exchangeRateDataService.toCurrency( |
|
|
|
order.fee, |
|
|
|
order.SymbolProfile.currency, |
|
|
|
userCurrency |
|
|
|
), |
|
|
|
valueInBaseCurrency: this.exchangeRateDataService.toCurrency( |
|
|
|
value, |
|
|
|
order.SymbolProfile.currency, |
|
|
|
userCurrency |
|
|
|
) |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
@ -237,14 +237,10 @@ export class PortfolioService { |
|
|
|
types: ['DIVIDEND'] |
|
|
|
}); |
|
|
|
|
|
|
|
let dividends = activities.map(({ date, SymbolProfile, value }) => { |
|
|
|
let dividends = activities.map(({ date, valueInBaseCurrency }) => { |
|
|
|
return { |
|
|
|
date: format(date, DATE_FORMAT), |
|
|
|
investment: this.exchangeRateDataService.toCurrency( |
|
|
|
value, |
|
|
|
SymbolProfile.currency, |
|
|
|
userCurrency |
|
|
|
) |
|
|
|
investment: valueInBaseCurrency |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
@ -768,14 +764,8 @@ export class PortfolioService { |
|
|
|
.filter(({ type }) => { |
|
|
|
return type === 'DIVIDEND'; |
|
|
|
}) |
|
|
|
.map(({ SymbolProfile, value }) => { |
|
|
|
return new Big( |
|
|
|
this.exchangeRateDataService.toCurrency( |
|
|
|
value, |
|
|
|
SymbolProfile.currency, |
|
|
|
userCurrency |
|
|
|
) |
|
|
|
); |
|
|
|
.map(({ valueInBaseCurrency }) => { |
|
|
|
return new Big(valueInBaseCurrency); |
|
|
|
}) |
|
|
|
); |
|
|
|
|
|
|
@ -2105,15 +2095,11 @@ export class PortfolioService { |
|
|
|
quantity, |
|
|
|
SymbolProfile, |
|
|
|
type, |
|
|
|
unitPrice |
|
|
|
valueInBaseCurrency |
|
|
|
} of ordersByAccount) { |
|
|
|
const unitPriceInBaseCurrency = |
|
|
|
portfolioItemsNow[SymbolProfile.symbol]?.marketPriceInBaseCurrency ?? |
|
|
|
this.exchangeRateDataService.toCurrency( |
|
|
|
unitPrice, |
|
|
|
SymbolProfile.currency, |
|
|
|
userCurrency |
|
|
|
) ?? |
|
|
|
valueInBaseCurrency ?? |
|
|
|
0; |
|
|
|
|
|
|
|
let currentValueOfSymbolInBaseCurrency = |
|
|
|