using System.ComponentModel.DataAnnotations.Schema; using YLErp.Commons; namespace YLErp.Modules.SuperviseReportModule.CFMMC2022.Model { public abstract class SuperviseReportBaseModel { /// /// 交易对手方2名称 /// public string ClientName { get; set; } /// /// 交易对手方2的统一社会信用代码 /// public string ClientLicenseCode { get; set; } /// /// 交易对手方2的LEI /// public string ClientLEI { get; set; } /// /// 主协议类型 /// public string ProtocalType { get; set; } /// /// 主协议日期 /// public DateTime? ProtocolSignDate { get; set; } /// /// 生效日 /// public string ProtocolSignDateString { get { return ProtocolSignDate == null ? null : ProtocolSignDate.Value.ToString("yyyy-MM-dd"); } } /// /// 是否中央对手方清算 /// public string IsCentralClearingPlatform { get; set; } /// /// 中央清算平台名称 /// public string CentralClearingPlatform { get; set; } /// /// 交易平台 /// public string TradePlatform { get; set; } /// /// 持仓编号 /// public string PositionCode { get; set; } /// /// 多腿编号 /// public string MoreLegCode { get; set; } /// /// 生效日 /// public DateTime? StartDate { get; set; } /// /// 生效日 /// public string StartDateString { get { return StartDate == null ? null : StartDate.Value.ToString("yyyy-MM-dd"); } } /// /// 到期日 /// public DateTime? EndDate { get; set; } /// /// 到期日 /// public string EndDateString { get { return EndDate == null ? null : EndDate.Value.ToString("yyyy-MM-dd"); } } /// /// 提前终止日期 /// public DateTime? UnWindDate { get; set; } /// /// 提前终止日期 /// public string UnWindDateString { get { return UnWindDate == null ? null : UnWindDate.Value.ToString("yyyy-MM-dd"); } } /// /// 成交编号 /// public string TradeNumber { get; set; } /// /// 交易确认时间 /// public DateTime? TradeDate { get; set; } /// /// 交易确认时间 /// public string TradeDateString { get { return TradeDate == null ? null : TradeDate.Value.ToString("yyyy-MM-dd"); } } /// /// 资产类型 /// public string VarietyType { get; set; } /// /// 交易对手方1方向 (1.针对期权和远期交易:B:买方S:卖方 2.针对互换交易:P:payer,即付固定、收浮动方 R:receiver,即收固定、付浮动方) /// public string ClientDirection { get; set; } /// /// 标的资产所属板块 /// public string UnderlyingPlate { get; set; } /// /// 买入卖出 /// public string BuySell { get; set; } /// /// 工具类型 /// public string ToolType { get; set; } /// /// 期权行权时间类型 /// public string ExerciseMode { get; set; } /// /// 期权权利类型 /// public string OptionType { get; set; } /// /// 交易类型 /// public string TradeType { get; set; } /// /// 结构化交易中的组合类型 /// 确定产品结构时使用 /// public string StructureType { get; set; } /// /// 二元期权PayoffType /// 确定产品结构时使用 /// public string PayoffType { get; set; } /// /// 标的资产品种 /// public string VarietyCode { get; set; } /// /// 标的资产对应合约 /// public string UnderlyingCode { get; set; } /// /// 标的期初价格 /// public string UnderlyingInitialPrice { get; set; } /// /// 标的期初价格货币 /// public string UnderlyingInitialPriceCurrency { get; set; } /// /// 标的期初价格符号 /// public string UnderlyingInitialPriceSymbol { get; set; } /// /// 平仓或终止时的标的价格 /// public string ClosedUnderlyingPrice { get; set; } /// /// 数量单位En /// public string QuoteUnitEn { get; set; } /// /// 执行价格1 /// private double? _strike; /// /// 执行价格1 /// public double? Strike { get { return _strike; } set { if (PS.Config.Company == Configuration.CompanyEnum.国投) { _strike = OtcFormatHelper.FormatValue(value, 2); } else { _strike = OtcFormatHelper.FormatValue(value, 4); } } } public string StrikeString { get { if (PS.Config.Company == Configuration.CompanyEnum.国投) { return Strike == null ? null : Strike.Value.ToString("0.##"); } else { return Strike == null ? null : Strike.Value.ToString("0.####"); } } } private double? _strike2; /// /// 执行价格2 /// public double? Strike2 { get { return _strike2; } set { if (PS.Config.Company == Configuration.CompanyEnum.国投) { _strike2 = OtcFormatHelper.FormatValue(value, 2); } else { _strike2 = OtcFormatHelper.FormatValue(value, 4); } } } /// /// 执行价格2 /// public string Strike2String { get { if (PS.Config.Company == Configuration.CompanyEnum.国投) { return Strike2 == null ? null : Strike2.Value.ToString("0.##"); } else { return Strike2 == null ? null : Strike2.Value.ToString("0.####"); } } } private double? _strike3; /// /// 执行价格3 /// public double? Strike3 { get { return _strike3; } set { if (PS.Config.Company == Configuration.CompanyEnum.国投) { _strike3 = OtcFormatHelper.FormatValue(value, 2); } else { _strike3 = OtcFormatHelper.FormatValue(value, 6); } } } /// /// 执行价格3 /// public string Strike3String { get { if (PS.Config.Company == Configuration.CompanyEnum.国投) { return Strike3 == null ? null : Strike3.Value.ToString("0.##"); } else { return Strike3 == null ? null : Strike3.Value.ToString("0.######"); } } } /// /// 执行价格货币 /// public string StrikeCurrency { get; set; } /// /// 执行价格符号 /// public string StrikeSymbol { get; set; } /// /// 观察类型 /// public string ObserveType { get; set; } /// /// 观察起始日 /// public DateTime? ObserveStartDate { get; set; } /// /// 观察起始日 /// public string ObserveStartDateString { get { return ObserveStartDate == null ? null : ObserveStartDate.Value.ToString("yyyy-MM-dd"); } } /// /// 观察结束日 /// public DateTime? ObserveEndDate { get; set; } /// /// 观察结束日 /// public string ObserveEndDateString { get { return ObserveEndDate == null ? null : ObserveEndDate.Value.ToString("yyyy-MM-dd"); } } /// /// 观察周期 DAIL:日度 WEEK:周度 MNTH:月度 YEAR:年度 Other:其他 /// public string ObservationPeriod { get; set; } public double? _observePeriodMultiplier { get; set; } /// /// 观察周期乘数 /// public double? ObservePeriodMultiplier { get { return _observePeriodMultiplier > 0 ? _observePeriodMultiplier : null; } set { _observePeriodMultiplier = OtcFormatHelper.FormatValue(value, 0); } } /// /// 观察周期乘数 /// public decimal? ObservePeriodMultiplierString { get { if (ObservePeriodMultiplier != null) { return decimal.Parse(ObservePeriodMultiplier.Value.ToString()); } return null; } } /// /// 收益计算方式 /// public string RevenueCalculationMethod { get; set; } /// /// 保底收益 /// public double? _guaranteedIncome { get; set; } /// /// 保底收益 /// public double? GuaranteedIncome { get { return _guaranteedIncome; } set { if (PS.Config.Company == Configuration.CompanyEnum.东吴) { _guaranteedIncome = (value != null && value.Value != 0) ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(double?); } else { _guaranteedIncome = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(double?); } } } /// /// 保底收益 /// public decimal? GuaranteedIncomeString { get { return GuaranteedIncome == null ? default(decimal?) : decimal.Parse(GuaranteedIncome.Value.ToString("0.####")); } } /// /// 保底收益货币 /// public string GuaranteedIncomeCurrency { get => GuaranteedIncome == null ? string.Empty : _guaranteedIncomeCurrency; set => _guaranteedIncomeCurrency = value; } /// /// 保底收益符号 /// public string GuaranteedIncomeSymbol { get => GuaranteedIncome == null ? string.Empty : _guaranteedIncomeSymbol; set => _guaranteedIncomeSymbol = value; } /// /// 行权收益1 /// public double? _exerciseBenefits; /// /// 行权收益1 /// public double? ExerciseBenefits { get { return _exerciseBenefits; } set { _exerciseBenefits = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// /// 行权收益1 /// public decimal? ExerciseBenefitsString { get { return ExerciseBenefits == null ? default(Nullable) : decimal.Parse(ExerciseBenefits.Value.ToString("0.######")); } } /// /// 行权收益2 /// public double? _exerciseBenefits2; /// /// 行权收益2 /// public double? ExerciseBenefits2 { get { return _exerciseBenefits2; } set { _exerciseBenefits2 = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// /// 行权收益2 /// public decimal? ExerciseBenefits2String { get { return ExerciseBenefits2 == null ? default(Nullable) : decimal.Parse(ExerciseBenefits2.Value.ToString("0.######")); } } /// /// 行权收益3 /// public double? _exerciseBenefits3; /// /// 行权收益3 /// public double? ExerciseBenefits3 { get { return _exerciseBenefits3; } set { _exerciseBenefits3 = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// /// 行权收益3 /// public decimal? ExerciseBenefits3String { get { return ExerciseBenefits3 == null ? default(Nullable) : decimal.Parse(ExerciseBenefits3.Value.ToString("0.######")); } } /// /// 行权收益货币 /// public string ExerciseBenefitsCurrency { get; set; } /// /// 行权收益符号 /// public string ExerciseBenefitsSymbol { get; set; } /// /// 障碍价1 /// public double? _barriersPrice { get; set; } /// /// 障碍价1 /// public double? BarriersPrice { get { return _barriersPrice; } set { _barriersPrice = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// /// 障碍价1 /// public string BarriersPriceString { get { return BarriersPrice == null ? null : BarriersPrice.Value.ToString("0.######"); } } /// /// 障碍价1触碰方向 /// public string BarriersPriceTouchDirection { get; set; } /// /// 障碍价1类型 /// public string BarriersPriceType { get; set; } /// /// 障碍价2 /// public double? _barriersPrice2 { get; set; } /// /// 障碍价2 /// public double? BarriersPrice2 { get { return _barriersPrice2; } set { _barriersPrice2 = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// /// 障碍价2 /// public string BarriersPrice2String { get { return BarriersPrice2 == null ? null : BarriersPrice2.Value.ToString("0.######"); } } /// /// 障碍价2触碰方向 /// public string BarriersPrice2TouchDirection { get; set; } /// /// 障碍价2类型 /// public string BarriersPrice2Type { get; set; } /// /// 补偿收益1 /// public double? _compensationIncome; /// /// 补偿收益1 /// public double? CompensationIncome { get { return _compensationIncome; } set { _compensationIncome = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// /// 补偿收益1 /// public decimal? CompensationIncomeString { get { return CompensationIncome == null ? default(Nullable) : decimal.Parse(CompensationIncome.Value.ToString("0.######")); } } /// /// 补偿收益2 /// public double? _compensationIncome2; /// /// 补偿收益2 /// public double? CompensationIncome2 { get { return _compensationIncome2; } set { _compensationIncome2 = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// /// 补偿收益2 /// public decimal? CompensationIncome2String { get { return CompensationIncome2 == null ? default(Nullable) : decimal.Parse(CompensationIncome2.Value.ToString("0.######")); } } /// /// 补偿收益货币 /// public string CompensationIncomeCurrency { get; set; } /// /// 补偿收益符号 /// public string CompensationIncomeSymbol { get; set; } /// /// SA&PA-敲入障碍价 /// public double? _knockInBarrierPrice { get; set; } /// /// SA&PA-敲入障碍价 /// public double? KnockInBarrierPrice { get { return _knockInBarrierPrice; } set { _knockInBarrierPrice = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// /// SA&PA-敲入障碍价 /// public string KnockInBarrierPriceString { get { return KnockInBarrierPrice == null ? null : KnockInBarrierPrice.Value.ToString("0.######"); } } /// /// SA&PA-敲入观察期 /// public string KnockInObservationPeriod { get; set; } /// /// SA&PA-敲出障碍价 /// public double? _knockOutBarrierPrice { get; set; } /// /// SA&PA-敲出障碍价 /// public double? KnockOutBarrierPrice { get { return _knockOutBarrierPrice; } set { _knockOutBarrierPrice = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// /// SA&PA-敲出障碍价 /// public string KnockOutBarrierPriceString { get { return KnockOutBarrierPrice == null ? null : KnockOutBarrierPrice.Value.ToString("0.######"); } } /// /// SA&PA-Coupon障碍价 /// public double? _couponBarrierPrice { get; set; } /// ///SA&PA-Coupon障碍价 /// public double? CouponBarrierPrice { get { return _couponBarrierPrice; } set { _couponBarrierPrice = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// /// SA&PA-Coupon障碍价 /// public string CouponBarrierPriceString { get { return CouponBarrierPrice == null ? null : CouponBarrierPrice.Value.ToString("0.######"); } } /// /// SA&PA-Coupon年化收益率 /// public double? _couponAnnualRate { get; set; } /// ///SA&PA-Coupon年化收益率 /// public double? CouponAnnualRate { get { return _couponAnnualRate; } set { _couponAnnualRate = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 6)) : default(Nullable); } } /// ///SA&PA-Coupon年化收益率 /// public decimal? CouponAnnualRateString { get { return CouponAnnualRate == null || double.IsInfinity(CouponAnnualRate ?? 0) ? default(Nullable) : decimal.Parse(CouponAnnualRate.Value.ToString("0.######")); } } /// /// 远期价格 /// public double? _forwardPrice { get; set; } /// /// 远期价格 /// public double? ForwardPrice { get { return _forwardPrice; } set { _forwardPrice = value != null ? OtcFormatHelper.FormatValue(value.Value, 4) : default(Nullable); } } /// /// 远期价格 /// public string ForwardPriceString { get { return ForwardPrice == null ? null : ForwardPrice.Value.ToString("0.####"); } } /// /// 远期价格货币 /// public string ForwardPriceCurrency { get; set; } /// /// 远期价格符号 /// public string ForwardPriceSymbol { get; set; } /// /// 固定收益 /// public double? _fixedIncome { get; set; } /// /// 固定收益 /// public double? FixedIncome { get { return _fixedIncome; } set { _fixedIncome = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 4)) : default(Nullable); } } /// /// 固定收益 /// public decimal? FixedIncomeString { get { return FixedIncome == null ? default(Nullable) : decimal.Parse(FixedIncome.Value.ToString("0.####")); } } /// /// 固定收益货币 /// public string FixedIncomeCurrency { get; set; } /// /// 固定收益符号 /// public string FixedIncomeSymbol { get; set; } /// /// 浮动方方向 /// public string FloatingDirection { get; set; } /// /// 支付周期 /// public string PaymentCycle { get; set; } /// /// 支付周期乘数 /// public double? _paymentCycleMultiplier { get; set; } /// /// 支付周期乘数 /// public double? PaymentCycleMultiplier { get { return _paymentCycleMultiplier > 0 ? _paymentCycleMultiplier : null; } set { _paymentCycleMultiplier = value != null ? Math.Abs(OtcFormatHelper.FormatValue(value.Value, 4)) : default(Nullable); } } /// /// 支付周期乘数 /// public string PaymentCycleMultiplierString { get { return PaymentCycleMultiplier == null ? null : PaymentCycleMultiplier.Value.ToString(); } } /// /// 初始名义金额 /// public string InitialNominalAmount { get; set; } private double? _foreignCurrencyRate; /// /// 外汇兑人民币期初汇率 /// public double? ForeignCurrencyRate { get { return _foreignCurrencyRate; } set { _foreignCurrencyRate = value.HasValue ? (double?)OtcFormatHelper.FormatValue(value ?? 0, 4) : null; } } /// /// 初始名义数量 /// public string InitialNominalNumber { get; set; } /// /// 数量单位 /// public string QuoteUnit { get; set; } /// /// 是否为年化名义金额 /// public string IsAnnualizedNominalAmount { get; set; } private double? _participateRate; /// /// 参与率 /// public double? ParticipateRate { get { return _participateRate; } set { _participateRate = OtcFormatHelper.FormatValue(value, 4); } } /// /// 参与率 /// public decimal? ParticipateRateString { get { return ParticipateRate == null ? default(Nullable) : decimal.Parse(ParticipateRate.Value.ToString("0.####")); } } public string DeltaCash { get; set; } /// /// 结算方式 /// public string SettlementMethod { get; set; } /// /// 最后结算日 /// public DateTime? LastUnWindDate { get; set; } /// /// 最后结算日 /// public string LastUnWindDateString { get { return LastUnWindDate == null ? null : LastUnWindDate.Value.ToString("yyyy-MM-dd"); } } /// /// 交易Id /// public int TradeId { get; set; } /// /// 交易确认书编号 /// public string ContractCode { get; set; } /// /// 行权日 /// public DateTime? ExerciseDate { get; set; } /// /// 行权日 /// public string ExerciseDateString { get { return ExerciseDate == null ? null : ExerciseDate.Value.ToString("yyyy-MM-dd"); } } /// /// 期权产品结构 /// public string OptionProductStructure { get; set; } #region 辅助属性 [NotMapped] public DateTime? OptDate { get; set; } [NotMapped] public string OriginalTradeNumber { get; set; } public trade _trade; private string _guaranteedIncomeCurrency; private string _guaranteedIncomeSymbol; public trade originalTrade { get; set; } [NotMapped] public trade trade { get { try { if (_trade == null) { if (!string.IsNullOrWhiteSpace(TradeJson)) { _trade = trade.Deserialize(TradeJson); } else { _trade = originalTrade; } } } catch (Exception ex) { LogFactory.GetLogger("NewSuperviseReportBaseModel").Error(ex); } return _trade; } } [NotMapped] public string TradeJson { get; set; } ///// ///// 报价单位比率 ///// 通常情况下只有鸡蛋会是2 ///// //[NotMapped] //public int CountRatio { get; set; } [NotMapped] public string OriginalVarietyCode { get; set; } /// /// 平仓比例 /// [NotMapped] public double? UnwindPercentRate { get; set; } /// /// 客户Id /// [NotMapped] public int ClientId { get; set; } /// /// 父交易Id /// [NotMapped] public int? ParentTradeId { get; set; } /// /// 交易状态 /// [NotMapped] public string TradeStatus { get; set; } public int IsGroup { get; set; } public double? _delta { get; set; } public double? _gamma { get; set; } /// /// 期权的资产类型 /// [NotMapped] public string ProductType { get; set; } /// /// 观察日列表,一个或多个日期字符串,日期之间以逗号分隔 /// 例如:2019-07-16,2019-08-16 /// [NotMapped] public string ObservationDates { get; set; } /// /// 平仓或终止时的标的价格 /// [NotMapped] public double? FinalPrice { get; set; } /// /// 自定义字段扩展 /// [NotMapped] public string ExtendInfo { get; set; } [NotMapped] public class StructureDetailInfo { public string name { get; set; } public string value { get; set; } } /// /// 标的物几家货币 /// public string QuoteCurrency { get; set; } /// /// 报告当天日期 /// public DateTime ValueDate { get; set; } /// /// 黑箱一年有效天数 /// public string ValidDaysStr { get; set; } [NotMapped] public bool IsStock { get; set; } = false; /// /// 日终价格 /// public double? _price { get; set; } #endregion } }