bug修复
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user