diff --git a/YLErpDAL/Modules/SwapModule/SwapDealService.cs b/YLErpDAL/Modules/SwapModule/SwapDealService.cs index ffcc5ee7..5f87491a 100644 --- a/YLErpDAL/Modules/SwapModule/SwapDealService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapDealService.cs @@ -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; } + /// + /// 保证金腿的利息方向翻转。保证金利息是券商付给客户(方向与融资腿相反)。 + /// 待迁入 Margin 模块。 + /// + private static int FlipMarginDirection(int direction) + => direction == (int)SwapDirectionEnum.收取 + ? (int)SwapDirectionEnum.支付 + : (int)SwapDirectionEnum.收取; + /// /// 初始化利息腿信息 /// @@ -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)//当日无适用观察日