TRS-ZS-560 费用保留2位落库,平仓利息保留2位,估值保留2位
This commit is contained in:
@@ -1282,6 +1282,7 @@ namespace YLErp.BLL.Eod
|
||||
var flowEvents = swapFlowEvents.Where(x => x.SwapTradeId == item.Key).ToList();
|
||||
var unwindQty = flowEvents.Sum(s => s.Quantity);
|
||||
var pnl = lastEodSwap.PostionValue;
|
||||
pnl=Math.Round(pnl, ConsGlobal.MoneyRound,MidpointRounding.AwayFromZero);
|
||||
decimal unwindPercent = 0;
|
||||
if (unwindQty != 0)
|
||||
{
|
||||
|
||||
@@ -809,6 +809,7 @@ namespace YLErp.Modules.EodModule.SettlementModule
|
||||
var lastEodSwap = eodSwaps.FirstOrDefault(t => t.SwapTradeId == item.SwapTradeId && t.ValueDate == preBalanceDate);
|
||||
var lastEodSwapPosition = eodSwapPosis.FirstOrDefault(t => t.SwapTradeId == item.SwapTradeId && t.ValueDate == preBalanceDate&&t.PosiStartDate<= preBalanceDate);
|
||||
var eodSwapPosition = clientEodSwapPositionLast.FirstOrDefault(t => t.SwapTradeId == item.SwapTradeId && t.ValueDate == balanceDate && t.PosiStartDate <= balanceDate);
|
||||
item.PostionValue=Math.Round(item.PostionValue, ConsGlobal.MoneyRound,MidpointRounding.AwayFromZero);
|
||||
PotentialSurpluses += Convert.ToDouble(item.PostionValue) * (-1);
|
||||
// WinLoss += Convert.ToDouble(item.TdRealizedPnL) * (-1);
|
||||
var lastPv = lastEodSwap != null ? Convert.ToDouble(lastEodSwap.PostionValue) * (-1) : 0;
|
||||
|
||||
+1
-1
@@ -334,7 +334,7 @@ namespace YLErp.Modules.ReportModule.SettlementReportModule
|
||||
PositionPremiumNetCash = clientBalance?.PositionPremiumNetCash ?? 0,
|
||||
SellTradePrice = clientBalance?.SellTradePrice,
|
||||
LastDayPositionPremiumNetCash = clientBalance?.LastDayPositionPremiumNetCash ?? 0,
|
||||
WinLoss = clientBalance?.WinLoss ?? 0,
|
||||
WinLoss =Math.Round( clientBalance?.WinLoss ?? 0,ConsGlobal.MoneyRound,MidpointRounding.AwayFromZero),
|
||||
ClosedTradeFundGap = clientBalance?.ClosedTradeFundGap ?? 0,
|
||||
ClosedTradePayableFund = clientBalance?.ClosedTradePayableFundTotal ?? 0,
|
||||
PositionTradePayableFund = clientBalance?.MarginByPayableMarginTotal ?? 0,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -265,6 +265,12 @@ namespace YLErp.Web.Controllers
|
||||
public JsonResult GetUnwindInterestList(DateTime valueDate,DateTime unwindDate, int tradeId, decimal closePercent, int eventType)
|
||||
{
|
||||
var interests = new SwapDealService(CurUser).GetUnwindInterests(valueDate, unwindDate, tradeId, closePercent, eventType);
|
||||
foreach (var interest in interests)
|
||||
{
|
||||
interest.TdInterestAmount=Math.Round(interest.TdInterestAmount, ConsGlobal.MoneyRound,MidpointRounding.AwayFromZero);
|
||||
interest.InterestAmount=Math.Round(interest.InterestAmount, ConsGlobal.MoneyRound,MidpointRounding.AwayFromZero);
|
||||
interest.InterestClosePnL=Math.Round(interest.InterestClosePnL, ConsGlobal.MoneyRound,MidpointRounding.AwayFromZero);
|
||||
}
|
||||
return JsonSuccess("", interests);
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user