fix(swap): 解决互换交易全额平仓计算和判定问题
- 在前端计算函数中添加全额平仓时返回剩余数量的逻辑 - 添加针对 trade2308 问题的单元测试验证全额平仓场景 - 实现后端全额平仓请求标准化处理方法 NormalizeFullCloseRequest - 添加重新计算标准化平仓金额的方法 RecalculateNormalizedUnwindAmounts - 实现平仓后是否全额关闭的判定逻辑 IsFullCloseAfterDeduction - 在平仓流程中集成全额平仓标准化处理和金额重新计算 - 更新平仓后交易状态和剩余金额数量的处理逻辑 - 完善审批流程中的平仓数据标准化和流动事件处理 - 优化持仓扣减时全额平仓的处理逻辑 - 添加多个单元测试验证各种全额平仓场景的正确性
This commit is contained in:
@@ -182,6 +182,19 @@ describe('多次部分平仓:全部↔部分切换 CloseQty 不跳变(占期
|
||||
expectClose(closeQty, 25000000, '应=25000000 不受 JS 浮点偏差影响');
|
||||
expect(closeQty).not.toBe(24999999.999999996);
|
||||
});
|
||||
|
||||
test('trade2308: full close uses the remaining quantity after fixed6 percent formatting', () => {
|
||||
const notionalValue = 9812312.31;
|
||||
const posiNotionalValue = 4906156.15;
|
||||
const oriClosePercent = posiNotionalValue / notionalValue;
|
||||
const closePercent = 0.5;
|
||||
const positionQty = 5000000;
|
||||
|
||||
const closeQty = SwapCalc.calcCloseQtyByOriginalPercent(
|
||||
closePercent, oriClosePercent, positionQty);
|
||||
|
||||
expect(closeQty).toBe(positionQty);
|
||||
});
|
||||
});
|
||||
|
||||
describe('交叉校验:对齐 C# FrontendCalcCharacterizationTest 金标准', () => {
|
||||
|
||||
Reference in New Issue
Block a user