namespace YLErp.Models { /// /// 预付金参数Model /// public class MarginParamModel { private double minPriceChange = 0.01; /// /// 预付金比率 /// public double? MarginRate { get; set; } /// /// Span波动率变动(这个值在页面配置上限制为正数) /// public double? VolatilityRate { get; set; } /// /// Span涨跌幅度 /// public double? UpDownLimit { get; set; } /// /// Span涨跌幅度是否绝对值 /// public bool IsUpDownLimitFixed { get; set; } /// /// 最小价格变动(默认0.01)(最小取0.01) /// public double MinPriceChange { get { return minPriceChange; } set { minPriceChange = value < 0.01 ? 0.01 : value; } } /// /// /// public static MarginParamModel Create(double? MarginRate, string VolatilityRate, string UpDownLimit, bool checkUpDownLimitFixed) { var model = new MarginParamModel { MarginRate = MarginRate }; if (NumberHelper.TryParse(VolatilityRate?.TrimToNull(), out var dvalue, out var isPercent)) { model.VolatilityRate = dvalue; } if (NumberHelper.TryParse(UpDownLimit?.TrimToNull(), out dvalue, out isPercent)) { model.UpDownLimit = dvalue; model.IsUpDownLimitFixed = checkUpDownLimitFixed && !isPercent; } return model; } } }