Bugfix/restore incorrect fee currency conversion (#4645)
* Restore incorrect fee currency conversion * Update changelog
This commit is contained in:
parent
5b6447b60d
commit
28d2fd3877
@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Renamed `Account` to `accounts` in the `Platform` database schema
|
||||
- Upgraded `prisma` from version `6.6.0` to `6.7.0`
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed an issue with the fee calculations related to activities in a custom currency
|
||||
|
||||
## 2.159.0 - 2025-05-02
|
||||
|
||||
### Added
|
||||
|
@ -118,6 +118,7 @@ export class ImportService {
|
||||
createdAt: undefined,
|
||||
fee: 0,
|
||||
feeInAssetProfileCurrency: 0,
|
||||
feeInBaseCurrency: 0,
|
||||
id: assetProfile.id,
|
||||
isDraft: false,
|
||||
SymbolProfile: assetProfile,
|
||||
@ -126,7 +127,8 @@ export class ImportService {
|
||||
unitPrice: marketPrice,
|
||||
unitPriceInAssetProfileCurrency: marketPrice,
|
||||
updatedAt: undefined,
|
||||
userId: Account?.userId
|
||||
userId: Account?.userId,
|
||||
valueInBaseCurrency: value
|
||||
};
|
||||
})
|
||||
);
|
||||
|
@ -12,11 +12,13 @@ export interface Activity extends Order {
|
||||
Account?: AccountWithPlatform;
|
||||
error?: ActivityError;
|
||||
feeInAssetProfileCurrency: number;
|
||||
feeInBaseCurrency: number;
|
||||
SymbolProfile?: EnhancedSymbolProfile;
|
||||
tags?: Tag[];
|
||||
unitPriceInAssetProfileCurrency: number;
|
||||
updateAccountBalance?: boolean;
|
||||
value: number;
|
||||
valueInBaseCurrency: number;
|
||||
}
|
||||
|
||||
export interface ActivityError {
|
||||
|
@ -531,31 +531,46 @@ export class OrderService {
|
||||
|
||||
const value = new Big(order.quantity).mul(order.unitPrice).toNumber();
|
||||
|
||||
const [
|
||||
feeInAssetProfileCurrency,
|
||||
feeInBaseCurrency,
|
||||
unitPriceInAssetProfileCurrency,
|
||||
valueInBaseCurrency
|
||||
] = await Promise.all([
|
||||
this.exchangeRateDataService.toCurrencyAtDate(
|
||||
order.fee,
|
||||
order.currency ?? order.SymbolProfile.currency,
|
||||
order.SymbolProfile.currency,
|
||||
order.date
|
||||
),
|
||||
this.exchangeRateDataService.toCurrencyAtDate(
|
||||
order.fee,
|
||||
order.currency ?? order.SymbolProfile.currency,
|
||||
userCurrency,
|
||||
order.date
|
||||
),
|
||||
this.exchangeRateDataService.toCurrencyAtDate(
|
||||
order.unitPrice,
|
||||
order.currency ?? order.SymbolProfile.currency,
|
||||
order.SymbolProfile.currency,
|
||||
order.date
|
||||
),
|
||||
this.exchangeRateDataService.toCurrencyAtDate(
|
||||
value,
|
||||
order.currency ?? order.SymbolProfile.currency,
|
||||
userCurrency,
|
||||
order.date
|
||||
)
|
||||
]);
|
||||
|
||||
return {
|
||||
...order,
|
||||
feeInAssetProfileCurrency,
|
||||
feeInBaseCurrency,
|
||||
unitPriceInAssetProfileCurrency,
|
||||
value,
|
||||
feeInAssetProfileCurrency:
|
||||
await this.exchangeRateDataService.toCurrencyAtDate(
|
||||
order.fee,
|
||||
order.currency ?? order.SymbolProfile.currency,
|
||||
order.SymbolProfile.currency,
|
||||
order.date
|
||||
),
|
||||
SymbolProfile: assetProfile,
|
||||
unitPriceInAssetProfileCurrency:
|
||||
await this.exchangeRateDataService.toCurrencyAtDate(
|
||||
order.unitPrice,
|
||||
order.currency ?? order.SymbolProfile.currency,
|
||||
order.SymbolProfile.currency,
|
||||
order.date
|
||||
),
|
||||
valueInBaseCurrency:
|
||||
await this.exchangeRateDataService.toCurrencyAtDate(
|
||||
value,
|
||||
order.currency ?? order.SymbolProfile.currency,
|
||||
userCurrency,
|
||||
order.date
|
||||
)
|
||||
valueInBaseCurrency,
|
||||
SymbolProfile: assetProfile
|
||||
};
|
||||
})
|
||||
);
|
||||
|
@ -8,6 +8,7 @@ export const activityDummyData = {
|
||||
currency: undefined,
|
||||
fee: undefined,
|
||||
feeInAssetProfileCurrency: undefined,
|
||||
feeInBaseCurrency: undefined,
|
||||
id: undefined,
|
||||
isDraft: false,
|
||||
symbolProfileId: undefined,
|
||||
|
Loading…
x
Reference in New Issue
Block a user