40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using YLErp.Abstract.DataProviders;
|
|
using YLErp.DBModels.Consts;
|
|
using YLErp.Modules.CalculationModule;
|
|
using YLErp.Modules.CalculationModule.Abstract;
|
|
|
|
namespace YLErp.Modules.TradeRiskCalcModule.TaskRunner
|
|
{
|
|
/// <summary>
|
|
/// 持仓风险对冲计算上下文
|
|
/// </summary>
|
|
class TradeRiskHedgePnlCalcContext : HedgePnlCalcContext
|
|
{
|
|
readonly IOtcTradeValueCalcContext _optionCalContext;
|
|
|
|
public TradeRiskHedgePnlCalcContext(IOtcTradeValueCalcContext optionCalcContext,
|
|
IExchangeTradeCommissionCalc tradeCommissionCalc, IPriceProvider exchangeOptionPriceProvider)
|
|
: base(optionCalcContext, tradeCommissionCalc, exchangeOptionPriceProvider)
|
|
{
|
|
_optionCalContext = optionCalcContext;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建期权计算上下文对象
|
|
/// </summary>
|
|
public override IOtcTradeValueCalcContext CreateOptionCalculateContext()
|
|
{
|
|
return new OptionValueCalcContext(VolType, IsEodCalc, ValueDate
|
|
, _optionCalContext.SysRiskFreeRate
|
|
, _optionCalContext.DataProvider)
|
|
{
|
|
AddingVolRate = 0,
|
|
ErrorHandler = ErrorHandler,
|
|
CalcDeltaT1 = TradeRiskHelper.IsCalcDeltaT1(),
|
|
CalcScenario = CalcScenario,
|
|
UserGroup = ConsUserGroup.DefaultGroup
|
|
};
|
|
}
|
|
}
|
|
}
|