feat: 新增成交收益率字段

This commit is contained in:
gongpei
2025-10-13 17:13:22 +08:00
parent a2962cfc4b
commit 7be89a8c1d
13 changed files with 70 additions and 56 deletions
@@ -282,13 +282,18 @@ namespace YLErp.Modules.SwapModule
}
var retListResult = eventQuery.ToSearchList(req);
List<trade_extend> extendList = null;
if(retListResult!=null&& retListResult.rows!=null&& retListResult.rows.Any())
Dictionary<int, decimal> ytmMap = new Dictionary<int, decimal>();
if (retListResult != null && retListResult.rows != null && retListResult.rows.Any())
{
var tradeIds = retListResult.rows.Where(p => p.PayDate == null || p.EventType != (int)SwapEventTypeEnum.).Select(p=>p.SwapTradeId).Distinct().ToList();
var tradeIds = retListResult.rows.Where(p => p.PayDate == null || p.EventType != (int)SwapEventTypeEnum.).Select(p => p.SwapTradeId).Distinct().ToList();
if (tradeIds != null && tradeIds.Count > 0)
{
extendList = DbContext.trade_extend.AsNoTracking().Where(p => tradeIds.Contains(p.TradeId)).ToList();
// 查询成交收益率
ytmMap = DbContext.trade.AsNoTracking().Where(p => tradeIds.Contains(p.id)).ToList().ToDictionary(t => t.id, t => t.InitYtm);
}
}
if (extendList == null)
{
@@ -296,6 +301,7 @@ namespace YLErp.Modules.SwapModule
}
foreach (var item in retListResult.rows)
{
item.InitYtm = ytmMap.GetValueOrDefault(item.SwapTradeId);
if (ConsGlobal.InstrumentType.IsBond(item.UnderlyingInstrumentType))
{
item.TradingAmountAvg *= ConsGlobal.bondShowPriceMultiple;