91 lines
3.2 KiB
C#
91 lines
3.2 KiB
C#
using YieldChain.Helpers;
|
|
using YLErp.Modules.EodModule.SettlementModule;
|
|
using YLErp.Modules.SuperviseReportModule.ChangJiangReport.Service;
|
|
|
|
namespace YLErp.Modules.EodModule.CompanySpecial
|
|
{
|
|
/// <summary>
|
|
/// 长江日终结算任务
|
|
/// </summary>
|
|
class ChangJiangService
|
|
{
|
|
/// <summary>
|
|
/// 长江日终结算任务
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <param name="volType">持仓 或 对冲 或 开仓</param>
|
|
/// <param name="settlePriceType">收盘价 或 结算价</param>
|
|
/// <exception cref="ArgumentNullException"></exception>
|
|
public static void EodExecute(EodSettlementContextV2 context, string volType, string settlePriceType)
|
|
{
|
|
if (context is null)
|
|
{
|
|
throw new ArgumentNullException(nameof(context));
|
|
}
|
|
|
|
if (volType == "持仓" && settlePriceType == "收盘价")
|
|
{
|
|
try
|
|
{
|
|
var clienIds = context.Request.ClientIds;
|
|
new SuperviseReportClientCashService(context.UserInfo).SaveReportData(context.SettleDate, clienIds);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogFactory.GetLogger("长江衍生品客户资金表").Error(ex);
|
|
}
|
|
|
|
try
|
|
{
|
|
new SuperviseReportCreditRiskService(context.UserInfo).SaveReportData(context.SettleDate);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogFactory.GetLogger("长江衍生品信用风险表").Error(ex);
|
|
}
|
|
}
|
|
|
|
try
|
|
{
|
|
var nv = UrlHelper.ParseQueryString(PS.Config.ErpElement.Supervise_Position);
|
|
|
|
var exposureMode = nv?["敞口算法"];
|
|
|
|
switch (exposureMode)
|
|
{
|
|
case "收盘价+持仓波动率":
|
|
if (volType == "持仓" && settlePriceType == "收盘价")
|
|
{
|
|
break;
|
|
}
|
|
return;
|
|
case "结算价+持仓波动率":
|
|
if (volType == "持仓" && settlePriceType == "结算价")
|
|
{
|
|
break;
|
|
}
|
|
return;
|
|
case "结算价+对冲波动率":
|
|
if (volType == "对冲" && settlePriceType == "结算价")
|
|
{
|
|
break;
|
|
}
|
|
return;
|
|
default:
|
|
if (volType == "对冲" && settlePriceType == "收盘价")
|
|
{
|
|
break;
|
|
}
|
|
return;
|
|
}
|
|
|
|
new SuperviseReportPositionService(context.UserInfo).SaveReportData(context.SettleDate, exposureMode);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogFactory.GetLogger("长江场外业务持仓表").Error(ex);
|
|
}
|
|
}
|
|
}
|
|
}
|