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 SpotPrices { get; set; } public Dictionary Dividends { get; set; } public double? OverrideTTM { get; set; } public bool HasNightMarket { get; set; } public bool PreciseTimeMode { get; set; } public int maturityShift { get; set; } /// /// 深拷贝(保留运行时类型)。 /// /// 用 MemberwiseClone 保证克隆对象与 this 运行时类型一致—— /// 例如 VanillaOptionParameter 克隆后仍是 VanillaOptionParameter, /// 否则 ValueCalculator 内 parameter as VanillaOptionParameter 会因类型退化为基类而得到 null。 /// 引用型字段 SpotPrices/Dividends 单独深拷,避免对克隆体 bump 时污染原参数。 /// /// public virtual ParameterBase Clone() { var clone = (ParameterBase)MemberwiseClone(); clone.SpotPrices = SpotPrices == null ? null : new Dictionary(SpotPrices); clone.Dividends = Dividends == null ? null : new Dictionary(Dividends); return clone; } } }