594 lines
16 KiB
C#
594 lines
16 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using YLErp.Commons;
|
|
|
|
namespace YLErp.DBModels
|
|
{
|
|
[Table("trade_cash")]
|
|
public class trade_cash : TradeExtendBase, IClonable<trade_cash>
|
|
{
|
|
|
|
|
|
|
|
public trade_cash()
|
|
{
|
|
if (this.id == 0 || this.CreateTime == null)
|
|
{
|
|
this.CreateTime = DateTime.Now;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 事件发生日
|
|
/// <para>事件发生日和结算日不相同时,该字段应被赋值,其他场景该字段为Null</para>
|
|
/// <para>开仓时该字段存实际开仓日(非操作日期)</para>
|
|
/// <para>了结时该字段存实际了结日(非操作日期)</para>
|
|
/// <para>如遇节假日则国君为前一个交易日,其他为下一个交易日</para>
|
|
/// </summary>
|
|
[DisplayName("事件记录时间")]
|
|
public DateTime? HappenedDate { set; get; }
|
|
|
|
private double? _barrierPrice;
|
|
/// <summary>
|
|
/// 敲出障碍价格(仅当该笔流水为敲出流水的时候,这个字段才有值不为null)
|
|
/// </summary>
|
|
[DisplayName("敲出障碍价格")]
|
|
public double? BarrierPrice
|
|
{
|
|
set { _barrierPrice = value.FormatValue(2); }
|
|
get { return _barrierPrice; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 该字段标记的无效并不是真的无效
|
|
/// 在复核和结算环节都会用到无效的记录
|
|
/// </summary>
|
|
[DisplayName("是否有效")]
|
|
public string ValidState { get; set; }
|
|
/// <summary>
|
|
/// 该字段标记该记录是否已被从系统中删除
|
|
/// 只有证券业报送时,会使用到已删除的数据
|
|
/// </summary>
|
|
public bool IsDeleted { get; set; }
|
|
public static string LogClass = "现金交割交易";
|
|
|
|
/// <summary>
|
|
/// 期权类型
|
|
/// </summary>
|
|
[NotMapped]
|
|
[DisplayName("期权类型")]
|
|
public string OptionType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 行权价类型
|
|
/// </summary>
|
|
[NotMapped]
|
|
[DisplayName("行权价类型")]
|
|
public string StrikeType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 主交易Id
|
|
/// </summary>
|
|
public int ParentTradeId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 分组主交易资金记录id
|
|
/// </summary>
|
|
public int ParentTradeCashId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 交割方式
|
|
/// </summary>
|
|
[DisplayName("交割方式")]
|
|
public string ExceciseType { set; get; }
|
|
|
|
/// <summary>
|
|
/// 操作类型
|
|
/// </summary>
|
|
[DisplayName("操作类型"), Required]
|
|
public string Action { set; get; }
|
|
|
|
/// <summary>
|
|
/// 买卖方向
|
|
/// </summary>
|
|
[DisplayName("买卖方向")]
|
|
public string TradeType { set; get; }
|
|
|
|
/// <summary>
|
|
/// 交易表对应的交易类型
|
|
/// </summary>
|
|
[NotMapped]
|
|
public string Trade_TradeType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 看涨看跌
|
|
/// </summary>
|
|
[DisplayName("看涨看跌")]
|
|
public string CallPut { set; get; }
|
|
|
|
/// <summary>
|
|
/// 行权价
|
|
/// </summary>
|
|
[DisplayName("行权价")]
|
|
public double? Strike { set; get; }
|
|
|
|
[DisplayName("行权价")]
|
|
[NotMapped]
|
|
public string StrikeString { get; set; }
|
|
|
|
/// <summary>
|
|
/// 目前组合交易考虑只有两个行权价
|
|
/// </summary>
|
|
[DisplayName("行权价")]
|
|
[NotMapped]
|
|
public double? StrikeTwo { get; set; }
|
|
|
|
[DisplayName("行权价")]
|
|
[NotMapped]
|
|
public string StrikeTwoString { get; set; }
|
|
|
|
/// <summary>
|
|
/// 份额
|
|
/// </summary>
|
|
[DisplayName("份额")]
|
|
public double Notional { set; get; }
|
|
|
|
/// <summary>
|
|
/// 当前行权份额占原始份额的比例
|
|
/// 平仓时当前总持仓份额占原始份额的比例
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double NotionalPercent { get; set; }
|
|
|
|
/// <summary>
|
|
/// 数量
|
|
/// </summary>
|
|
[DisplayName("数量")]
|
|
public double? TradeAmount { get; set; }
|
|
|
|
private double _amount;
|
|
|
|
/// <summary>
|
|
/// 交割金额(包含额外金额,不包含权利金)
|
|
/// </summary>
|
|
[DisplayName("交割金额")]
|
|
public double Amount
|
|
{
|
|
set { _amount = value.FormatValue(2); }
|
|
get { return _amount; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 计价交割金额
|
|
/// </summary>
|
|
[DisplayName("计价交割金额")]
|
|
public double? QuoteAmount { get; set; }
|
|
|
|
[NotMapped]
|
|
public double MinusAmount
|
|
{
|
|
get { return (-Amount); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 实现盈亏(包含额外金额,包含权利金)
|
|
/// 盯市报告用到 double
|
|
/// </summary>
|
|
[NotMapped]
|
|
public string WinLoss { get; set; }
|
|
|
|
/// <summary>
|
|
/// 计价盈亏 -- 互换提前终止详情页用到--国君
|
|
/// </summary>
|
|
[NotMapped]
|
|
public string QuoteWinloss { get; set; }
|
|
|
|
[NotMapped]
|
|
public double WinLossDouble
|
|
{
|
|
get
|
|
{
|
|
double.TryParse(WinLoss, out var temp);
|
|
return temp;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 期末价格(包含亚式的执行均价)
|
|
/// </summary>
|
|
[DisplayName("期末价格")]
|
|
public double? FinalPrice { get; set; }
|
|
|
|
/// <summary>
|
|
/// 期末现价
|
|
/// </summary>
|
|
[DisplayName("期末现价")]
|
|
public double? SpotPrice { get; set; }
|
|
/// <summary>
|
|
/// 平仓类型
|
|
/// </summary>
|
|
[DisplayName("平仓类型")]
|
|
public string UnwindType { set; get; }
|
|
/// <summary>
|
|
/// 平仓方式 0名义本金,1数量
|
|
/// </summary>
|
|
[DisplayName("平仓方式")]
|
|
public int? UnwindMethod { set; get; }
|
|
|
|
/// <summary>
|
|
/// 平仓方式名称
|
|
/// </summary>
|
|
[NotMapped]
|
|
public string UnwindMethodName
|
|
{
|
|
get
|
|
{
|
|
string[] methodName = new string[] { "名义本金", "数量" };
|
|
return methodName[UnwindMethod ?? 0];
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 平仓总额
|
|
/// </summary>
|
|
[DisplayName("平仓费总额")]
|
|
[NotMapped]
|
|
public string UnwindFee
|
|
{
|
|
get; set;
|
|
}
|
|
|
|
[DisplayName("平仓单价检查")]
|
|
[NotMapped]
|
|
public double? UnwindPriceCheck { get; set; }
|
|
|
|
/// <summary>
|
|
/// 平仓单价费率
|
|
/// </summary>
|
|
[DisplayName("平仓单价检查")]
|
|
[NotMapped]
|
|
public double? UnwindPricePercentRateCheck { get; set; }
|
|
|
|
/// <summary>
|
|
/// 平仓单价
|
|
/// </summary>
|
|
[DisplayName("平仓单价")]
|
|
public double? UnwindPrice { get; set; }
|
|
|
|
[DisplayName("期权价值")]
|
|
[NotMapped]
|
|
public double? SinglePV { get; set; }
|
|
|
|
[DisplayName("期权价值")]
|
|
[NotMapped]
|
|
public double? SinglePVPercentRate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 期权平仓价格/行权收益
|
|
/// 盯市报告用到
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double SingleWinPrice { get; set; }
|
|
|
|
[NotMapped]
|
|
public string SingleWinPriceString { get; set; }
|
|
|
|
/// <summary>
|
|
/// 期权平仓价格/行权收益 比例
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double SingleWinPricePercent { get; set; }
|
|
|
|
/// <summary>
|
|
/// 平仓份额
|
|
/// </summary>
|
|
[DisplayName("平仓份额")]
|
|
public double? UnwindNotional { get; set; }
|
|
|
|
/// <summary>
|
|
/// 平仓数量
|
|
/// </summary>
|
|
[DisplayName("平仓数量")]
|
|
public double? UnwindTradeAmount { get; set; }
|
|
|
|
/// <summary>
|
|
/// 平仓行权互换票息操作的初始名义本金占比(该字段用于算实现盈亏用到)当到期互换和票息,该字段设置为0
|
|
/// </summary>
|
|
[DisplayName("平仓比例")]
|
|
public double? UnwindPercentRate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 平仓行权互换票息操作的初始名义本金占比
|
|
/// </summary>
|
|
[DisplayName("平仓比例")]
|
|
public double? NotionalPercentRate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 平仓单价比例
|
|
/// </summary>
|
|
[DisplayName("平仓单价")]
|
|
public double? UnwindPricePercentRate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 平仓行权份额
|
|
/// 盯市报告用到
|
|
/// </summary>
|
|
[NotMapped]
|
|
public string ActionNotional { get; set; }
|
|
|
|
/// <summary>
|
|
/// 平仓行权数量
|
|
/// 盯市报告用到
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double ActionTradeAmount { get; set; }
|
|
/// <summary>
|
|
/// 平仓行权虚拟数量
|
|
/// 盯市报告用到
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double ActionTradeAmountV { get; set; }
|
|
|
|
/// <summary>
|
|
/// 名义本金
|
|
/// </summary>
|
|
[DisplayName("持仓名义本金")]
|
|
[NotMapped]
|
|
public double StockEqvNotional { get; set; }
|
|
|
|
/// <summary>
|
|
/// 平仓名义本金
|
|
/// </summary>
|
|
//[NotMapped]
|
|
[DisplayName("平仓名义本金")]
|
|
public double? UnwindStockEqvNotional { get; set; }
|
|
|
|
[DisplayName("成交名义本金")]
|
|
[NotMapped]
|
|
public double OriginalStockEqvNotional { get; set; }
|
|
|
|
private double? _extraAmount;
|
|
[DisplayName("额外金额")]
|
|
public double? ExtraAmount
|
|
{
|
|
get { return _extraAmount; }
|
|
set { _extraAmount = value.FormatValue(2); }
|
|
}
|
|
|
|
[DisplayName("默认金额")]
|
|
[NotMapped]
|
|
[DisplayFormat(DataFormatString = "{0:F2}", ApplyFormatInEditMode = true)]
|
|
public double InitialAmount { get; set; }
|
|
|
|
[DisplayName("平仓波动率")]
|
|
public double? UnwindVol { get; set; }
|
|
|
|
[DisplayName("波动率类型")]
|
|
public string VolType { get; set; }
|
|
|
|
[DisplayName("客户名称")]
|
|
[NotMapped]
|
|
public string ClientName { get; set; }
|
|
|
|
[NotMapped]
|
|
public string TraderName { get; set; }
|
|
|
|
[DisplayName("标的代码")]
|
|
[NotMapped]
|
|
public string UnderlyingCode { get; set; }
|
|
|
|
[DisplayName("标的名")]
|
|
[NotMapped]
|
|
public string UnderlyingName { get; set; }
|
|
|
|
[NotMapped]
|
|
public string UnderlyingInstrumentType { get; set; }
|
|
|
|
[NotMapped]
|
|
public bool IsMoneynessOptionData { get; set; }
|
|
|
|
[NotMapped]
|
|
public bool IsMoneynessOption { get; set; }
|
|
|
|
[DisplayName("期初价格")]
|
|
[NotMapped]
|
|
public double InitialSpotPrice { get; set; }
|
|
|
|
[DisplayName("有效行权价")]
|
|
[NotMapped]
|
|
public double ValidStrike { get; set; }
|
|
|
|
[DisplayName("是否可以执行")]
|
|
[NotMapped]
|
|
public bool IsPossibleExec { get; set; }
|
|
|
|
[DisplayName("行权费率(‱)")]
|
|
[NotMapped]
|
|
public double? ExerciseCostRatio { get; set; }
|
|
|
|
/// <summary>
|
|
/// 资金结算日
|
|
/// <para>资金发生日和结算日不相同时,该字段应被赋值为结算日</para>
|
|
/// </summary>
|
|
[DisplayName("操作时间")]
|
|
public DateTime ValueDate { set; get; }
|
|
|
|
/// <summary>
|
|
/// 交易溢价
|
|
/// </summary>
|
|
[DisplayName("了结溢价")]
|
|
public double TradePremium { get; set; }
|
|
|
|
/// <summary>
|
|
/// 返还预付金
|
|
/// </summary>
|
|
[DisplayName("返还预付金")]
|
|
public double AdvanceMoney { get; set; }
|
|
|
|
/// <summary>
|
|
/// 起始日期
|
|
/// </summary>
|
|
[NotMapped]
|
|
public DateTime StartDate { get; set; }
|
|
|
|
[NotMapped]
|
|
public string ValueDateString
|
|
{
|
|
get
|
|
{
|
|
if (HappenedDate != null)
|
|
{
|
|
return HappenedDate.Value.ToString("yyyy-MM-dd");
|
|
}
|
|
else if (ValueDate != DateTime.MinValue)
|
|
{
|
|
return ValueDate.ToString("yyyy-MM-dd");
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
}
|
|
|
|
public string Status { set; get; }
|
|
|
|
/// <summary>
|
|
/// 结算日
|
|
/// </summary>
|
|
[DisplayName("结算日")]
|
|
public DateTime? SettleDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 备注
|
|
/// </summary>
|
|
[DisplayName("备注")]
|
|
public string Comments { get; set; }
|
|
|
|
/// <summary>
|
|
/// 行权方式
|
|
/// </summary>
|
|
[DisplayName("行权方式")]
|
|
public string ExerciseWay { get; set; }
|
|
|
|
/// <summary>
|
|
/// 了结编号
|
|
/// </summary>
|
|
[DisplayName("了结编号")]
|
|
public string Number { get; set; }
|
|
|
|
[DisplayName("看涨看跌")]
|
|
[NotMapped]
|
|
public string CallPutDesc
|
|
{
|
|
get
|
|
{
|
|
if (CallPut == "Call")
|
|
{
|
|
return "看涨";
|
|
}
|
|
|
|
return "看跌";
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string TradeNumber { get; set; }
|
|
[NotMapped]
|
|
public double? OriginalNotional { get; set; }
|
|
|
|
[NotMapped]
|
|
public double? TradeOriginalAmount { get; set; }
|
|
|
|
[NotMapped]
|
|
public int? UnderlyingId { get; set; }
|
|
|
|
[DisplayName("计划期限")]
|
|
[NotMapped]
|
|
public double? DurationDays { get; set; }
|
|
|
|
/// <summary>
|
|
/// 期权类型
|
|
/// </summary>
|
|
[NotMapped]
|
|
public string BondType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 交易确认日
|
|
/// <para>财务确认入账日期</para>
|
|
/// <para>财务汇总页面赋值</para>
|
|
/// </summary>
|
|
public DateTime ConfirmDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否最终了结操作
|
|
/// 代表只有交易完全了结了,该值才会为true
|
|
/// </summary>
|
|
public bool IsLastAction { get; set; }
|
|
|
|
public double? CurrencyRate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否通过期权费率设置权利金
|
|
/// </summary>
|
|
[NotMapped]
|
|
public bool? IsUsePremiumRate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否通过名义本金方式平仓
|
|
/// </summary>
|
|
[NotMapped]
|
|
public bool? IsUnwindStockEqvNotional { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否总额成交方式
|
|
/// </summary>
|
|
[NotMapped]
|
|
public bool? IsTradePricePayType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否到期执行操作
|
|
/// </summary>
|
|
[NotMapped]
|
|
public bool? IsExpire { get; set; }
|
|
|
|
[NotMapped]
|
|
public double? ParticipationRate { get; set; }
|
|
|
|
[NotMapped]
|
|
public double? PrincipalSum { get; set; }
|
|
[NotMapped]
|
|
public double? OriginalPrincipalSum { get; set; }
|
|
|
|
[NotMapped]
|
|
public double? AnnualizeFactor { get; set; }
|
|
|
|
/// <summary>
|
|
/// 东证字段 平仓价格和用Mid Vol计算的PV差
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double? Day1Pnl { get; set; }
|
|
|
|
[NotMapped]
|
|
public string BuySell { get; set; }
|
|
|
|
[NotMapped]
|
|
public trade_cash_swap trade_cash_swap { get; set; } = new trade_cash_swap();
|
|
|
|
public trade_cash Clone()
|
|
{
|
|
return (trade_cash)MemberwiseClone();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建时间
|
|
/// </summary>
|
|
public DateTime? CreateTime { get; set; }
|
|
}
|
|
|
|
[NotMapped]
|
|
public class TradeCashDto : trade_cash
|
|
{
|
|
|
|
}
|
|
}
|