fix: 手动平仓分红收益计算
This commit is contained in:
@@ -71,6 +71,7 @@ namespace YLErp.Modules.SwapModule
|
||||
}
|
||||
else
|
||||
{
|
||||
unwindData.TradeStartDate = td.StartDate;
|
||||
unwindData.CloseType = commodity ? 1 : 2;
|
||||
unwindData.StartDate = td.TradeDate.Value;
|
||||
if (preDealDate.HasValue)
|
||||
@@ -880,13 +881,15 @@ namespace YLErp.Modules.SwapModule
|
||||
floatEvent.TradingFeePending = position.PosiTradingFeePending * unwindData.ClosePercent;
|
||||
floatEvent.TradingFeePending = Math.Round(floatEvent.TradingFeePending, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
floatEvent.TradingFee = closeFee;
|
||||
|
||||
BondPaymentService bondPaymentService = new BondPaymentService(UserInfo);
|
||||
var tax = GetUnderlyingTax(floatEvent.UnderlyingCode);
|
||||
var payments = bondPaymentService.GetBondPayments(floatEvent.UnderlyingCode, td.StartDate.Value, floatEvent.UnwindDate.Value);
|
||||
var payment = bondPaymentService.CalcPayment(payments, unwindQty, longRatio, floatRatio);
|
||||
floatEvent.DividendIn = payment / (1 + tax) * (1 - tax);
|
||||
// 只计算事件日期当天的分红收益
|
||||
var payments = bondPaymentService.GetTargetDatePayments(floatEvent.UnderlyingCode, floatEvent.EventDate);
|
||||
floatEvent.DividendIn = bondPaymentService.CalcPayment(payments, unwindQty, longRatio, floatRatio) / (1 + tax) * (1 - tax);
|
||||
floatEvent.DividendIn = Math.Round(floatEvent.DividendIn, 2, MidpointRounding.AwayFromZero);
|
||||
floatEvent.DividendPending = bondPaymentService.CalcPayment(payments, floatEvent.PositionQty ?? 0, longRatio, floatRatio);
|
||||
floatEvent.DividendPending = bondPaymentService.CalcPayment(payments, floatEvent.PositionQty ?? 0, longRatio, floatRatio) / (1 + tax) * (1 - tax);
|
||||
|
||||
|
||||
floatEvent.MarkClosePnl = (unwindPrice - position.PosiGrossPrice) * unwindQty * floatRatio * longRatio;
|
||||
floatEvent.MarkClosePnl = Math.Round(floatEvent.MarkClosePnl + ((floatEvent.TradingFeePending+ closeFee) * floatRatio * -1) + floatEvent.DividendIn, ConsGlobal.MoneyRound, MidpointRounding.AwayFromZero);
|
||||
|
||||
Reference in New Issue
Block a user