Fix fee conversion (#2896)

* Fix fee conversion

* Update changelog
pull/2898/head
Thomas Kaul 5 months ago committed by GitHub
parent 4ac661fb94
commit 8d5f2fd91d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improved the language localization for German (`de`)
- Upgraded `prisma` from version `5.7.1` to `5.8.1`
### Fixed
- Fixed an issue in the performance calculation with the currency conversion of fees
## 2.41.0 - 2024-01-16
### Added
@ -3034,7 +3038,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed an issue with the user currency of the public page
- Fixed an issue of the performance calculation with recent activities in the new calculation engine
- Fixed an issue in the performance calculation with recent activities in the new calculation engine
## 1.127.0 - 16.03.2022

@ -3,6 +3,8 @@ import Big from 'big.js';
import { PortfolioOrder } from './portfolio-order.interface';
export interface PortfolioOrderItem extends PortfolioOrder {
feeInBaseCurrency?: Big;
feeInBaseCurrencyWithCurrencyEffect?: Big;
itemType?: '' | 'start' | 'end';
unitPriceInBaseCurrency?: Big;
unitPriceInBaseCurrencyWithCurrencyEffect?: Big;

@ -1266,6 +1266,7 @@ export class PortfolioCalculator {
date: format(start, DATE_FORMAT),
dataSource: null,
fee: new Big(0),
feeInBaseCurrency: new Big(0),
itemType: 'start',
name: '',
quantity: new Big(0),
@ -1279,6 +1280,7 @@ export class PortfolioCalculator {
date: format(end, DATE_FORMAT),
dataSource: null,
fee: new Big(0),
feeInBaseCurrency: new Big(0),
itemType: 'end',
name: '',
quantity: new Big(0),
@ -1306,6 +1308,7 @@ export class PortfolioCalculator {
date: format(day, DATE_FORMAT),
dataSource: null,
fee: new Big(0),
feeInBaseCurrency: new Big(0),
name: '',
quantity: new Big(0),
type: TypeOfOrder.BUY,
@ -1369,6 +1372,13 @@ export class PortfolioCalculator {
: unitPriceAtStartDate;
}
if (order.fee) {
order.feeInBaseCurrency = order.fee.mul(currentExchangeRate ?? 1);
order.feeInBaseCurrencyWithCurrencyEffect = order.fee.mul(
exchangeRateAtOrderDate ?? 1
);
}
if (order.unitPrice) {
order.unitPriceInBaseCurrency = order.unitPrice.mul(
currentExchangeRate ?? 1
@ -1468,10 +1478,10 @@ export class PortfolioCalculator {
}
}
fees = fees.plus(order.fee);
fees = fees.plus(order.feeInBaseCurrency ?? 0);
feesWithCurrencyEffect = feesWithCurrencyEffect.plus(
order.fee.mul(exchangeRateAtOrderDate ?? 1)
order.feeInBaseCurrencyWithCurrencyEffect ?? 0
);
totalUnits = totalUnits.plus(

Loading…
Cancel
Save