fix(swap): 修复平仓事件中事件日期=平仓日期的处理逻辑
- 将平仓条件判断从 UnwindDate 改为 EventDate - 移除不再使用的 priorClosePositionIds 变量 - 统一使用 NormalizeEventUnwindDate 替代 NormalizeIncomeUnwindDate - 在多个平仓方法中添加 NormalizeEventUnwindDate 调用 - 更新流程事件的 EventDate 和 UnwindDate 字段 - 修改单元测试以验证按 EventDate 分桶的逻辑 - 在前端控制器中将 unwindDate 设置为 valueDate - 添加 maxdate 属性到平仓日期选择器 - 实现事件日期与平仓日期的双向同步功能 - 更新利息列表获取接口使用统一日期参数
This commit is contained in:
@@ -44,7 +44,14 @@ function loadUnwindHelpers() {
|
||||
vueNumberInput() { return {}; }
|
||||
},
|
||||
swapPricePrecision: {
|
||||
createVueInputComponent() { return {}; }
|
||||
createVueInputComponent() { return {}; },
|
||||
getCommonInputFormat() { return {}; },
|
||||
normalizeCommon(type, value) { return value; },
|
||||
formatCommon(type, value) { return value; },
|
||||
getInputFormat(type, field, fallback) { return fallback; },
|
||||
roundForSubmit(value) { return value; },
|
||||
shiftDecimal(value) { return value; },
|
||||
format(value) { return value; }
|
||||
},
|
||||
tradeHelper: { IsBond() { return false; } },
|
||||
main: {
|
||||
@@ -94,6 +101,30 @@ describe('unwindSwapTrade 基础费率计算', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('事件日期与平仓日期双向同步', () => {
|
||||
const source = fs.readFileSync(
|
||||
path.join(__dirname, '..', 'wwwroot', 'Scripts', 'app', 'swaptrade', 'unwindSwapTrade.js'),
|
||||
'utf8'
|
||||
);
|
||||
const viewSource = fs.readFileSync(
|
||||
path.join(__dirname, '..', 'Views', 'SwapTrade2', 'SwapUnwind.cshtml'),
|
||||
'utf8'
|
||||
);
|
||||
|
||||
test('事件日期变更时同步平仓日期并触发利息重算', () => {
|
||||
expect(source).toMatch(/setValueDate\(e\)[\s\S]*deal\.UnwindDate\s*=\s*e[\s\S]*getInterestList\(\)/);
|
||||
});
|
||||
|
||||
test('平仓日期可选,变更时同步事件日期', () => {
|
||||
expect(viewSource).toMatch(/vue-datepicker[^>]*v-model="deal\.UnwindDate"[^>]*v-on:input="setUnwindDate"/);
|
||||
expect(source).toMatch(/setUnwindDate\(e\)[\s\S]*this\.setValueDate\(e\)/);
|
||||
});
|
||||
|
||||
test('预览利息请求使用事件日期作为计算日期', () => {
|
||||
expect(source).toMatch(/valueDate:\s*thisObj\.deal\.ValueDate[\s\S]*unwindDate:\s*thisObj\.deal\.ValueDate/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('base-rate pending trading fee', () => {
|
||||
const { swapPosiFeeCalc, consPosiFeeType } = loadUnwindHelpers();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user