TRS-ZS-560 费用保留2位落库,平仓利息保留2位,估值保留2位

This commit is contained in:
吴方海
2025-06-30 10:20:50 +08:00
parent 46d8c41f5e
commit dc1df57dcf
9 changed files with 26 additions and 10 deletions
@@ -71,6 +71,7 @@ namespace YLErp.Modules.SwapModule
swapFlow.UnderlyingCode = item.security_id;
swapFlow.TradingQty = (item.last_shares ?? 0) * 10000;
swapFlow.TradingFee = (item.commission ?? 0);
swapFlow.TradingFee = Math.Round(swapFlow.TradingFee, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
if (swapFlow.id == 0 || reset)
{
swapFlow.SwapTradeId = null;
@@ -358,6 +359,7 @@ namespace YLErp.Modules.SwapModule
TradingAmount = gourpItem.Sum(s => s.TradingAmount),
};
int tradeSide = swap_flow_summary.BsType == (int)EnumDirection.Long ? 1 : -1;
swap_flow_summary.TradingFeePending = Math.Round(swap_flow_summary.TradingFeePending, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
swap_flow_summary.FirstFlowTime = swapflow.OptTime;
swap_flow_summary.SettleDate = gourpItem.Max(s => s.SettleDate);
swap_flow_summary.TradingAmountAvg = swap_flow_summary.TradingQty == 0 ? 0 : gourpItem.Sum(s => s.TradingAmountAvg * s.TradingQty) / swap_flow_summary.TradingQty;
@@ -1144,7 +1146,8 @@ namespace YLErp.Modules.SwapModule
var newOpenQty = currentPosiQty - flowQty;
var unwindQty = newOpenQty > 0 ? flowQty : currentPosiQty;
var unwindFee = flowSameClone.TradingFeePending * unwindQty / currentPosiQty;
unwindFee=Math.Round(unwindFee,ConsGlobal.MoneyRound,MidpointRounding.AwayFromZero);
flowSameClone.TradingFeePending= flowSameClone.TradingFeePending - unwindFee;
flowQty = flowQty - unwindQty;
// 平仓
new SwapDealService(UserInfo).AuotoSwapUnwind(trade.id,
@@ -1157,11 +1160,8 @@ namespace YLErp.Modules.SwapModule
unwindFee);
if (flowQty>0)
{
var unwindPercent = 1 - (flowQty / flowSameClone.TradingQty);
var fee = (1 - unwindPercent) * flowSameClone.TradingFeePending;
flowSameClone.TradingQty = flowQty;
flowSameClone.TradingAmount = flowSameClone.TradingQty;
flowSameClone.TradingFeePending = fee;
NewSwapTrade(flowSameClone, client, asset, underlying, floatRate, clientMarginTemplate, clearingAgency);
}
}
@@ -1208,8 +1208,8 @@ namespace YLErp.Modules.SwapModule
var newOpenQty = posiQty - flowQty;
var unwindQty = newOpenQty > 0 ? flowQty : posiQty;
var unwindFee = swapFlow.TradingFeePending* unwindQty / flowQty;
flowQty = flowQty - unwindQty;
unwindFee=Math.Round(unwindFee, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
flowQty = flowQty - unwindQty;
swapFlow.TradingFeePending = swapFlow.TradingFeePending - unwindFee;
// 平仓
new SwapDealService(UserInfo).AuotoSwapUnwind(td.id,