fix: 恢复互换平仓交易费用按基础费率计算

This commit is contained in:
tengyufan
2026-08-05 18:26:15 +08:00
parent d5837f2de8
commit 46316c1400
4 changed files with 28 additions and 35 deletions
+9 -6
View File
@@ -43,6 +43,9 @@ function loadUnwindHelpers() {
vueDatePicker() { return {}; },
vueNumberInput() { return {}; }
},
swapPricePrecision: {
createVueInputComponent() { return {}; }
},
tradeHelper: { IsBond() { return false; } },
main: {
post() {
@@ -112,14 +115,14 @@ describe('base-rate pending trading fee', () => {
expectClose(result, 450.00);
});
test('partial close fee and pending fee both use the rounded opening fee allocation', () => {
const tradingFee = swapPosiFeeCalc.calcAllocatedTradingFee(
113.46, consPosiFeeType.Percent, 1.1234, 4039.2, 4000, 10098, 10000);
test('a manually adjusted pending fee does not override the base-rate close fee', () => {
const tradingFee = swapPosiFeeCalc.calcTradingFee(
consPosiFeeType.Unit, 0.123456, 0, 10000);
const pendingFee = swapPosiFeeCalc.calcTradingFeePending(
113.46, consPosiFeeType.Percent, 1.1234, 4039.2, 4000, 10098, 10000, 0.4);
1235.56, consPosiFeeType.Unit, 0.123456, 0, 10000, 0, 10000, 1);
expectClose(tradingFee, 45.38);
expectClose(pendingFee, 45.38);
expectClose(tradingFee, 1234.56);
expectClose(pendingFee, 1235.56);
});
test('without a configured base rate, the legacy close-percent calculation remains', () => {