TRS-ZS-560 费用保留2位落库,平仓利息保留2位,估值保留2位
This commit is contained in:
@@ -141,7 +141,7 @@ namespace YLErp.Modules.SwapModule
|
||||
swapFlow.TradingAmountFeeAvg = result.TradingAmountFeeAvg;
|
||||
swapFlow.TradingAmountNet = result.TradingAmountNet;
|
||||
swapFlow.TradingAmountNetFee = result.TradingAmountNetFee;
|
||||
swapFlow.TradingFee = result.TradingFee;
|
||||
swapFlow.TradingFee =Math.Round( result.TradingFee, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
swapFlow.TradingQty = result.TradingQty;
|
||||
swapFlow.trs_deal_id = result.trs_deal_id;
|
||||
swapFlow.UnderlyingCode = result.UnderlyingCode;
|
||||
|
||||
@@ -878,7 +878,7 @@ namespace YLErp.Modules.SwapModule
|
||||
floatEvent.TradingAmountNetFeeAvg = unwindNetFee;
|
||||
floatEvent.TradingAmountNetAvg = unwindNet;
|
||||
floatEvent.TradingFeePending = position.PosiTradingFeePending * unwindData.ClosePercent;
|
||||
floatEvent.TradingFeePending = Math.Round(floatEvent.TradingFeePending, 4, MidpointRounding.AwayFromZero);
|
||||
floatEvent.TradingFeePending = Math.Round(floatEvent.TradingFeePending, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
floatEvent.TradingFee = closeFee;
|
||||
floatEvent.MarkClosePnl = (unwindPrice - position.PosiGrossPrice) * unwindQty * floatRatio * longRatio;
|
||||
floatEvent.MarkClosePnl = Math.Round(floatEvent.MarkClosePnl + ((floatEvent.TradingFeePending+ closeFee) * floatRatio * -1), ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
@@ -894,6 +894,12 @@ namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
item.OptLog = "流水自动";
|
||||
});
|
||||
foreach (var item in interestPositions)
|
||||
{
|
||||
item.TdInterestAmount=Math.Round(item.TdInterestAmount, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
item.InterestAmount=Math.Round(item.InterestAmount, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
item.InterestClosePnL = Math.Round(item.InterestClosePnL, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
unwindData.FlowEvents.AddRange(interestPositions);
|
||||
CalcCloseAmount(unwindData);
|
||||
DealUnwind(unwindData, td);
|
||||
|
||||
@@ -1915,7 +1915,7 @@ namespace YLErp.Modules.SwapModule
|
||||
item.InterestAmount = eodInterests.Sum(s => s.InterestIncomeSum * (s.InterestDirection == (int)SwapDirectionEnum.收取 ? -1 : 1));
|
||||
item.InterestRate = eodInterests.Sum(s => s.InterestRateDefault);
|
||||
item.NetSettmentAmount += item.InterestAmount + item.MarginInterestAmount + eodMargins.Sum(s => s.InterestPrincipalFix * (s.InterestDirection == (int)SwapDirectionEnum.收取 ? 1 : -1));
|
||||
item.NetSettmentAmount = decimal.Parse(item.NetSettmentAmount.ToString("0.00"));
|
||||
item.NetSettmentAmount = Math.Round(item.NetSettmentAmount, ConsGlobal.MoneyRound,MidpointRounding.AwayFromZero);
|
||||
if (item.position.PosiNotionalValue != 0 && item.position.PosiNetPrice != 0)
|
||||
{
|
||||
item.FloatRateAbs = item.position.PosiNotionalValue == 0 ? 0 : item.InterestAmount / item.position.PosiNotionalValue;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1343,8 +1343,10 @@ namespace YLErp.Modules.SwapModule
|
||||
position.id = swap.id;
|
||||
position.PositionType = swap.PositionType;
|
||||
position.PosiTradingFee = swap.PosiTradingFee;
|
||||
position.PosiTradingFee=Math.Round(position.PosiTradingFee, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
position.PosiTradingFeeUnit = swap.PosiTradingFeeUnit;
|
||||
position.PosiTradingFeePending = swap.PosiTradingFeePending;
|
||||
position.PosiTradingFeePending = Math.Round(position.PosiTradingFeePending, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
position.UnderlyingCode = swap.UnderlyingCode;
|
||||
position.UnderlyingInstrumentType = swap.UnderlyingInstrumentType;
|
||||
position.PosiDirection = swap.PosiDirection;
|
||||
|
||||
Reference in New Issue
Block a user