fix: 导出估值报告携带成交收益率
This commit is contained in:
@@ -3,6 +3,7 @@ using ClosedXML.Report.Utils;
|
||||
using Confluent.Kafka;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using MoreLinq;
|
||||
using NPOI.OpenXmlFormats.Spreadsheet;
|
||||
using System.Collections.Generic;
|
||||
using YLErp.BLL.Calculation;
|
||||
using YLErp.DBModels;
|
||||
@@ -11,6 +12,7 @@ using YLErp.Model;
|
||||
using YLErp.Modules.AppModule;
|
||||
using YLErp.Modules.EodModule.QueryModule;
|
||||
using YLErp.QdpModule;
|
||||
using static YLErp.ConsGlobal;
|
||||
|
||||
namespace YLErp.Modules.SwapModule
|
||||
{
|
||||
@@ -498,7 +500,9 @@ namespace YLErp.Modules.SwapModule
|
||||
}
|
||||
var retListResult = query.ToSearchList(req);
|
||||
var tds= retListResult.rows.Select(x => x.FlowEvent.SwapTradeId).Distinct().ToList();
|
||||
var posiList = DbContext.swap_position.Where(s => !s.Invalid && s.IsInitial && tds.Contains(s.SwapTradeId)&&!string.IsNullOrEmpty(s.FloatRateUnderlyingCode)).ToList();
|
||||
var posiList = DbContext.swap_position.Where(s => !s.Invalid && s.IsInitial && tds.Contains(s.SwapTradeId) && !string.IsNullOrEmpty(s.FloatRateUnderlyingCode)).ToList();
|
||||
// 查询成交收益率
|
||||
Dictionary<int, decimal> ytmMap = DbContext.trade.AsNoTracking().Where(p => tds.Contains(p.id)).ToList().ToDictionary(t => t.id, t => t.InitYtm);
|
||||
foreach (var item in retListResult.rows)
|
||||
{
|
||||
item.FlowEvent.DividendPending = -item.FlowEvent.DividendPending;
|
||||
@@ -509,6 +513,7 @@ namespace YLErp.Modules.SwapModule
|
||||
item.FlowEvent.TradingFee = -item.FlowEvent.TradingFee;
|
||||
item.FlowEvent.TradingFeePending = -item.FlowEvent.TradingFeePending;
|
||||
item.FlowEvent.InterestClosePnL = -item.FlowEvent.InterestClosePnL;
|
||||
item.FlowEvent.InitYtm = ytmMap.GetValueOrDefault(item.FlowEvent.SwapTradeId);
|
||||
var posi= posiList.FirstOrDefault(s => s.id == item.FlowEvent.PositionId);
|
||||
item.FloatRateUnderlyingCode= posi?.FloatRateUnderlyingCode;
|
||||
if (item.FlowEvent.EventType==(int)SwapFlowEventTypeEnum.开仓)
|
||||
|
||||
@@ -355,6 +355,7 @@ namespace YLErp.Modules.SwapModule
|
||||
/// <param name="valueDate"></param>
|
||||
public List<swap_flow_merge> SummaryFlow(List<swap_flow> swapFlows, DateTime valueDate, bool save = true, Action<string> callback = null)
|
||||
{
|
||||
DateTime settleDate = QdpCalendarHelper.GetNonHoliday(valueDate.AddDays(1));
|
||||
var swapFlowGroup = swapFlows.GroupBy(g => new { g.ClientId, g.OccurTime, g.UnderlyingCode, g.BsType }).ToList();
|
||||
List<swap_flow_merge> list = new List<swap_flow_merge>();
|
||||
foreach (var gourpItem in swapFlowGroup)
|
||||
@@ -389,7 +390,7 @@ namespace YLErp.Modules.SwapModule
|
||||
swap_flow_summary.TradingAmountNetFeeAvg = swap_flow_summary.TradingQty == 0 ? swap_flow_summary.TradingAmountNetAvg : swap_flow_summary.TradingAmountNetAvg + swap_flow_summary.TradingFeePending * tradeSide / swap_flow_summary.TradingQty;
|
||||
swap_flow_summary.TradingAmountNetFeeAvg = Math.Round(swap_flow_summary.TradingAmountNetFeeAvg ?? 0, 10);
|
||||
// 计算收益率
|
||||
CalBondResult result = BondCalcHepler.BondCalcByDate(gourpItem.Key.UnderlyingCode, swap_flow_summary.TradingAmountAvg * ConsGlobal.bondShowPriceMultiple, valueDate.ToString("yyyy-MM-dd"));
|
||||
CalBondResult result = BondCalcHepler.BondCalcByDate(gourpItem.Key.UnderlyingCode, swap_flow_summary.TradingAmountAvg * ConsGlobal.bondShowPriceMultiple, settleDate.ToString("yyyy-MM-dd"));
|
||||
if (result != null)
|
||||
{
|
||||
swap_flow_summary.InitYtm = result.ytm * ConsGlobal.bondPriceMultiple;
|
||||
|
||||
Binary file not shown.
@@ -171,7 +171,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin: 0;">
|
||||
<label>清算日期</label>
|
||||
<label>交易日期</label>
|
||||
<vue-datepicker :holiday="1" v-model="tradeDate" id="tradeDate"
|
||||
style="width: 140px;"></vue-datepicker>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user