fix: 统一互换部分平仓交易费用与待结算费用的分摊舍入
This commit is contained in:
@@ -112,6 +112,16 @@ 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);
|
||||
const pendingFee = swapPosiFeeCalc.calcTradingFeePending(
|
||||
113.46, consPosiFeeType.Percent, 1.1234, 4039.2, 4000, 10098, 10000, 0.4);
|
||||
|
||||
expectClose(tradingFee, 45.38);
|
||||
expectClose(pendingFee, 45.38);
|
||||
});
|
||||
|
||||
test('without a configured base rate, the legacy close-percent calculation remains', () => {
|
||||
const result = swapPosiFeeCalc.calcTradingFeePending(
|
||||
2000, consPosiFeeType.Percent, 0, 300000, 3000, 1000000, 10000, 0.42);
|
||||
|
||||
Reference in New Issue
Block a user