Files
zszq-trs/YLErpDAL/BLL/Calculation/V2/Parameter/ParameterBase.cs
T
hjhan 985162242d feat(greeks): 新增 risk-factor bump 计算与注册
ParameterBase.Clone() 保留运行时类型深拷贝; ValueCalculator 两个薄接入方法; GreeksBumpCalculator/GreeksRiskFactor 引擎。加法性重定价桥,不动现有定价输出。
2026-07-21 15:28:15 +08:00

37 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Qdp.Foundation.Implementations;
namespace YLErp.BLL.Calculation.V2.Parameter
{
public class ParameterBase
{
public DateTime ValueDate { get; set; }
public string EngineName { get; set; }
public string DiscountCurveName { get; set; }
//如果RiskFreeRate有值,则使用如果RiskFreeRate,忽略DiscountCurveName
public double? RiskFreeRate { get; set; }
public Dictionary<string, double> SpotPrices { get; set; }
public Dictionary<Date, double> Dividends { get; set; }
public double? OverrideTTM { get; set; }
public bool HasNightMarket { get; set; }
public bool PreciseTimeMode { get; set; }
public int maturityShift { get; set; }
/// <summary>
/// 深拷贝(保留运行时类型)。
/// <para>
/// 用 MemberwiseClone 保证克隆对象与 <c>this</c> 运行时类型一致——
/// 例如 <c>VanillaOptionParameter</c> 克隆后仍是 <c>VanillaOptionParameter</c>
/// 否则 ValueCalculator 内 <c>parameter as VanillaOptionParameter</c> 会因类型退化为基类而得到 null。
/// 引用型字段 SpotPrices/Dividends 单独深拷,避免对克隆体 bump 时污染原参数。
/// </para>
/// </summary>
public virtual ParameterBase Clone()
{
var clone = (ParameterBase)MemberwiseClone();
clone.SpotPrices = SpotPrices == null ? null : new Dictionary<string, double>(SpotPrices);
clone.Dividends = Dividends == null ? null : new Dictionary<Date, double>(Dividends);
return clone;
}
}
}