feat: 新增成交收益率字段
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user