日终交易费用修复

This commit is contained in:
吴方海
2025-07-08 13:21:07 +08:00
parent 688ed0d682
commit e152388316
2 changed files with 6 additions and 17 deletions
@@ -1428,21 +1428,12 @@ namespace YLErp.BLL.EodSettlement
foreach (var item in clientEodSwaps.GroupBy(x => x.SwapTradeId))
{
var eventPosi = item.FirstOrDefault(t => t.PayDirection > 0);
var eventPosis = item.Where(t => t.PayDirection > 0).ToList();
var eventInterests = item.Where(t => t.PayDirection == 0).ToList();
foreach (var interest in eventInterests)
{
double ratio = interest.InterestDirection == (int)SwapDirectionEnum. ? 1 : -1;//收取为正,支付为负
if (marginTypes.Contains(interest.InterestMode))
{
ratio = -ratio;
}
interestPnl += Convert.ToDouble(interest.InterestClosePnL) * (-1);
}
interestPnl += Convert.ToDouble(eventInterests.Sum(s=>s.InterestClosePnL)) * (-1);
tradeFee += Convert.ToDouble(eventPosi.TradingFee+ eventPosi.TradingFeePending) * (-1);
tradeFee += Convert.ToDouble(eventPosis.Sum(s=>s.TradingFee+s.TradingFeePending)) * (-1);
}
clientBalance.trade_fee = tradeFee;
clientBalance.interest_pnl = interestPnl;
@@ -839,13 +839,11 @@ namespace YLErp.Modules.EodModule.SettlementModule
var clientEventFlowList = clientEventFlows.Where(x=>x.ClientId== client.id);
foreach (var item in clientEventFlowList.GroupBy(x => x.SwapTradeId))
{
var eventPosi = item.FirstOrDefault(t => t.PayDirection > 0);
var eventPosis = item.Where(t => t.PayDirection > 0).ToList();
var eventInterests = item.Where(t => t.PayDirection == 0).ToList();
interestPnl += Convert.ToDouble(eventInterests.Sum(s => s.InterestClosePnL)) * (-1);
interestPnl += Convert.ToDouble(eventInterests.Sum(x=>x.InterestClosePnL)) * (-1);
tradeFee += Convert.ToDouble(eventPosi.TradingFee + eventPosi.TradingFeePending) * (-1);
tradeFee += Convert.ToDouble(eventPosis.Sum(s => s.TradingFee + s.TradingFeePending)) * (-1);
}
var clientmarignQuery = marignQuery.Where(x => x.ClientId == client.id&&x.StructureType!="多空组合");
SwapMarinAmount = Convert.ToDouble(clientmarignQuery.Sum(s => s.marin));