refactor(margin): 抽取 FlipMarginDirection 保证金方向翻转方法
2处 inline 的保证金方向翻转(收取↔支付)抽成独立方法 FlipMarginDirection。 保证金利息是券商付给客户, 方向与融资腿相反。 - GetInterests 路径(854行): if(5||6) → MarginModes.Contains + FlipMarginDirection - 衡泰路径(1934行): 同上, 保留 _closePosiNotionalValue=0 判断从 InterestModeEnum==5||6 改为 MarginModes.Contains(统一口径)。 纯提取, 行为零变化。 验证: 编译0错误, 全量489测试7失败(基线一致)。
This commit is contained in:
@@ -12,6 +12,7 @@ using YLErp.Modules.EodModule;
|
||||
using YLErp.Modules.TradeModule;
|
||||
using YLErp.Modules.TradeModule.DealModule;
|
||||
using YLErp.Modules.SwapModule.InterestLegs;
|
||||
using YLErp.Modules.SwapModule.Margin;
|
||||
using YLErp.QdpModule;
|
||||
|
||||
namespace YLErp.Modules.SwapModule
|
||||
@@ -848,9 +849,9 @@ namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
closePrincipal = closePosiNotionalValue;
|
||||
}
|
||||
if ((InterestModeEnum)position.InterestMode == InterestModeEnum.追加预付金 || (InterestModeEnum)position.InterestMode == InterestModeEnum.初始预付金)
|
||||
if (MarginModes.Contains(position.InterestMode))
|
||||
{
|
||||
positionClone.InterestDirection = position.InterestDirection == (int)SwapDirectionEnum.收取 ? (int)SwapDirectionEnum.支付 : (int)SwapDirectionEnum.收取;
|
||||
positionClone.InterestDirection = FlipMarginDirection(position.InterestDirection);
|
||||
}
|
||||
|
||||
// 获取利率
|
||||
@@ -1169,6 +1170,15 @@ namespace YLErp.Modules.SwapModule
|
||||
: fallback;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保证金腿的利息方向翻转。保证金利息是券商付给客户(方向与融资腿相反)。
|
||||
/// 待迁入 Margin 模块。
|
||||
/// </summary>
|
||||
private static int FlipMarginDirection(int direction)
|
||||
=> direction == (int)SwapDirectionEnum.收取
|
||||
? (int)SwapDirectionEnum.支付
|
||||
: (int)SwapDirectionEnum.收取;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化利息腿信息
|
||||
/// </summary>
|
||||
@@ -1918,10 +1928,10 @@ namespace YLErp.Modules.SwapModule
|
||||
_closePosiNotionalValue = _posiNotionalValue * grossPrice * newClosePercent;
|
||||
_posiNotionalValue = _posiNotionalValue * grossPrice;
|
||||
}
|
||||
else if (item.InterestMode == (int)InterestModeEnum.追加预付金 || item.InterestMode == (int)InterestModeEnum.初始预付金)
|
||||
else if (MarginModes.Contains(item.InterestMode))
|
||||
{
|
||||
_closePosiNotionalValue = 0;
|
||||
positionClone.InterestDirection = position.InterestDirection == (int)SwapDirectionEnum.收取 ? (int)SwapDirectionEnum.支付 : (int)SwapDirectionEnum.收取;
|
||||
positionClone.InterestDirection = FlipMarginDirection(position.InterestDirection);
|
||||
}
|
||||
decimal rate = item.InterestRateDefault;
|
||||
if (swapIntervalToday != null)//当日无适用观察日
|
||||
|
||||
Reference in New Issue
Block a user