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
|
- Renamed `Account` to `accounts` in the `Platform` database schema
|
||||||
- Upgraded `prisma` from version `6.6.0` to `6.7.0`
|
- 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
|
## 2.159.0 - 2025-05-02
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -118,6 +118,7 @@ export class ImportService {
|
|||||||
createdAt: undefined,
|
createdAt: undefined,
|
||||||
fee: 0,
|
fee: 0,
|
||||||
feeInAssetProfileCurrency: 0,
|
feeInAssetProfileCurrency: 0,
|
||||||
|
feeInBaseCurrency: 0,
|
||||||
id: assetProfile.id,
|
id: assetProfile.id,
|
||||||
isDraft: false,
|
isDraft: false,
|
||||||
SymbolProfile: assetProfile,
|
SymbolProfile: assetProfile,
|
||||||
@ -126,7 +127,8 @@ export class ImportService {
|
|||||||
unitPrice: marketPrice,
|
unitPrice: marketPrice,
|
||||||
unitPriceInAssetProfileCurrency: marketPrice,
|
unitPriceInAssetProfileCurrency: marketPrice,
|
||||||
updatedAt: undefined,
|
updatedAt: undefined,
|
||||||
userId: Account?.userId
|
userId: Account?.userId,
|
||||||
|
valueInBaseCurrency: value
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -12,11 +12,13 @@ export interface Activity extends Order {
|
|||||||
Account?: AccountWithPlatform;
|
Account?: AccountWithPlatform;
|
||||||
error?: ActivityError;
|
error?: ActivityError;
|
||||||
feeInAssetProfileCurrency: number;
|
feeInAssetProfileCurrency: number;
|
||||||
|
feeInBaseCurrency: number;
|
||||||
SymbolProfile?: EnhancedSymbolProfile;
|
SymbolProfile?: EnhancedSymbolProfile;
|
||||||
tags?: Tag[];
|
tags?: Tag[];
|
||||||
unitPriceInAssetProfileCurrency: number;
|
unitPriceInAssetProfileCurrency: number;
|
||||||
updateAccountBalance?: boolean;
|
updateAccountBalance?: boolean;
|
||||||
value: number;
|
value: number;
|
||||||
|
valueInBaseCurrency: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ActivityError {
|
export interface ActivityError {
|
||||||
|
@ -531,31 +531,46 @@ export class OrderService {
|
|||||||
|
|
||||||
const value = new Big(order.quantity).mul(order.unitPrice).toNumber();
|
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 {
|
return {
|
||||||
...order,
|
...order,
|
||||||
|
feeInAssetProfileCurrency,
|
||||||
|
feeInBaseCurrency,
|
||||||
|
unitPriceInAssetProfileCurrency,
|
||||||
value,
|
value,
|
||||||
feeInAssetProfileCurrency:
|
valueInBaseCurrency,
|
||||||
await this.exchangeRateDataService.toCurrencyAtDate(
|
SymbolProfile: assetProfile
|
||||||
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
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -8,6 +8,7 @@ export const activityDummyData = {
|
|||||||
currency: undefined,
|
currency: undefined,
|
||||||
fee: undefined,
|
fee: undefined,
|
||||||
feeInAssetProfileCurrency: undefined,
|
feeInAssetProfileCurrency: undefined,
|
||||||
|
feeInBaseCurrency: undefined,
|
||||||
id: undefined,
|
id: undefined,
|
||||||
isDraft: false,
|
isDraft: false,
|
||||||
symbolProfileId: undefined,
|
symbolProfileId: undefined,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user