#EQD-6718 国联民生-收益互换隐藏收支方向,默认我方收取浮动收益
fix:国联民生收益互换隐藏收支方向,默认我方收取浮动收益 - 新增可配置开关 Erp.SwapFloatingIncomeReceiveOnlyMode,默认关闭,支持在普通模式与网厅适配模式之间切换 - 网厅适配模式下,新增及续做收益互换默认浮动端为我方收取,并隐藏新增、平仓、收益结算及查看页面的浮动端收支方向 - 普通模式保持原有展示和编辑逻辑,历史交易不修改原有浮动端收支方向 - 日终持仓风险_互换将浮动收支方向和标的多空合并为交易方向,并同步影响导出 - 交易方向映射收取+B为多头、收取+S为空头、支付+B为空头、支付+S为多头 - 新增交易方向映射专项前端单测
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const vm = require('vm');
|
||||
|
||||
function loadEodPositionRiskHelpers() {
|
||||
const filePath = path.join(__dirname, '../wwwroot/Scripts/app/swaptrade/EodPositionRisks.js');
|
||||
const code = fs.readFileSync(filePath, 'utf8') + '\nmodule.exports = { TradeDirectionFormat };';
|
||||
const sandbox = {
|
||||
module: { exports: {} },
|
||||
exports: {},
|
||||
$() { },
|
||||
main: {
|
||||
numberFormat() {
|
||||
return function () { };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
vm.runInNewContext(code, sandbox, { filename: filePath });
|
||||
return sandbox.module.exports;
|
||||
}
|
||||
|
||||
const { TradeDirectionFormat } = loadEodPositionRiskHelpers();
|
||||
|
||||
describe('互换日终持仓交易方向', () => {
|
||||
test.each([
|
||||
[1, 1, '多头'],
|
||||
[1, 2, '空头'],
|
||||
[2, 1, '空头'],
|
||||
[2, 2, '多头']
|
||||
])('收支方向=%i,多空方向=%i时展示%s', (posiDirection, positionType, expected) => {
|
||||
const row = { eodPosition: { PosiDirection: posiDirection, PositionType: positionType } };
|
||||
expect(TradeDirectionFormat(positionType, {}, row)).toBe(expected);
|
||||
});
|
||||
|
||||
test('无有效浮动端方向时不展示交易方向', () => {
|
||||
expect(TradeDirectionFormat(1, {}, { eodPosition: { PosiDirection: 0, PositionType: 1 } })).toBe('');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user