bug修复

This commit is contained in:
吴方海
2025-04-18 17:00:25 +08:00
parent a33d5a6ff2
commit 4b9bcfb2dc
10 changed files with 42 additions and 34 deletions
@@ -139,7 +139,15 @@ namespace YLErp.Modules.SwapModule
var longEventTypes = eventTyps;
longEventTypes.Add((int)SwapFlowEventTypeEnum.);
var flowEvents = new List<swap_flow_event>();
Expression<Func<swap_flow_event, bool>> eventExpression = x => x.SwapTradeId == td.id && x.DataState == (int)SwapFlowDateStateEnum. && longEventTypes.Contains(x.EventType)&& x.EventDate == settleDate;
Expression<Func<swap_flow_event, bool>> eventExpression = x => x.SwapTradeId == td.id && x.DataState == (int)SwapFlowDateStateEnum. && longEventTypes.Contains(x.EventType);
if (settleDate == td.TradeDate)
{
eventExpression = eventExpression.And(x => x.EventDate == settleDate);
}
else
{
eventExpression = eventExpression.And(x => x.UnwindDate == settleDate);
}
flowEvents = DbContext.swap_flow_event.Where(eventExpression).ToList();
var preDealDate = GetPreDealDate(td.id, settleDate, eventTyps);//上一次平仓/互换/自动互换处理日期
List<swap_flow_event> autoInterests = new List<swap_flow_event>();//自动互换利息腿信息
@@ -1341,15 +1349,15 @@ namespace YLErp.Modules.SwapModule
curretEod.PosiTradingFee = position.PosiTradingFee;
curretEod.UnderlyingPrice = UnderlyingCodePrice(position.UnderlyingCode, dealDate, out decimal vobp);
SetPriceInfoByFlowEvent(eod, curretEod, unwindEvents, position);
if (settleDate == td.TradeDate)
{
curretEod.UnderlyingPrice = curretEod.PosiGrossPrice;
//curretEod.TdCloseMtmPnl = 0;
//curretEod.TdCloseFee = 0;
}
curretEod.TdCloseDividend = curretEod.TdPosiDividend;
curretEod.UnderlyingMarketValue = curretEod.UnderlyingPrice * curretEod.PosiQuantity * curretEod.ContractSize * shortRatio;
curretEod.PosiMtmPnL = (curretEod.UnderlyingPrice - curretEod.PosiGrossPrice) * curretEod.PosiQuantity * curretEod.ContractSize * shortRatio * directionRatio;
if (settleDate == td.TradeDate)
{
curretEod.PosiMtmPnL = 0;
//curretEod.TdCloseMtmPnl = 0;
//curretEod.TdCloseFee = 0;
}
curretEod.PosiDividendSum = curretEod.TdPosiDividend;
curretEod.PosiProfitSum = curretEod.PosiMtmPnL + curretEod.PosiDividendSum + curretEod.VTradingFee;
curretEod.RealizedMtmPnL = curretEod.TdCloseMtmPnl;