124 lines
4.1 KiB
C#
124 lines
4.1 KiB
C#
using Newtonsoft.Json;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.ComponentModel.DataAnnotations;
|
||
using System.ComponentModel.DataAnnotations.Schema;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using YLErp.Helpers;
|
||
|
||
namespace YLErp.DBModels
|
||
{
|
||
/// <summary>
|
||
/// 框架合约交易要素簿记表
|
||
/// </summary>
|
||
[Table("trade_extend")]
|
||
public class trade_extend
|
||
{
|
||
/// <summary>
|
||
/// 交易id 主键
|
||
/// </summary>
|
||
[Key,DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||
[DisplayName("交易id")]
|
||
[DataChange]
|
||
public int TradeId { get; set; }
|
||
/// <summary>
|
||
/// 交易扩展元素JSON
|
||
/// </summary>
|
||
[DisplayName("交易扩展元素JSON")]
|
||
[DataChange]
|
||
public string ExtendJson { get; set; }
|
||
/// <summary>
|
||
/// 用于公司定制的扩展JSON
|
||
/// </summary>
|
||
[DisplayName("用于公司定制的扩展JSON")]
|
||
[DataChange]
|
||
public string CompanyJson { get; set; }
|
||
|
||
/// <summary>
|
||
/// 交易要素扩展对象
|
||
/// </summary>
|
||
[NotMapped]
|
||
public TradeExtendJson ExtendObj
|
||
{
|
||
get
|
||
{
|
||
if (string.IsNullOrEmpty(ExtendJson))
|
||
{
|
||
return new TradeExtendJson();
|
||
}
|
||
|
||
return JsonConvert.DeserializeObject<TradeExtendJson>(ExtendJson);
|
||
}
|
||
}
|
||
|
||
public trade_extend Clone()
|
||
{
|
||
return (trade_extend)MemberwiseClone();
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 交易要素扩展Json
|
||
/// </summary>
|
||
public class TradeExtendJson
|
||
{
|
||
/// <summary>
|
||
/// 流水簿记模式 0:否,1:先进先出,2:加权平均
|
||
/// </summary>
|
||
public int FlowBookMode { get; set; }
|
||
/// <summary>
|
||
/// 浮动收益年化
|
||
/// </summary>
|
||
public bool FloatingPnlAnnualized { get; set; }
|
||
/// <summary>
|
||
/// 是否收取开仓费
|
||
/// </summary>
|
||
public bool NeedOpenFee { get; set; }
|
||
/// <summary>
|
||
/// 收费类型 0:按手数收费,1:按份数收费
|
||
/// </summary>
|
||
public int OpenFeeType { get; set; }
|
||
/// <summary>
|
||
/// 年化天数
|
||
/// </summary>
|
||
public int AnnualDays { get; set; } = 365;
|
||
/// <summary>
|
||
/// 计息方式 00:不算头不算尾,01:不算头算尾,10:算头不算尾,11:算头算尾,缺省值:11
|
||
/// </summary>
|
||
public string InterestCalcMode { get; set; } = "11";
|
||
|
||
/// <summary>算头:InterestCalcMode 首位为 1;null/缺省视为算头。收口原 GetInterests/InitInterestDate/EOD三处 StartsWith 解析。</summary>
|
||
[JsonIgnore]
|
||
public bool CalcFirst => InterestCalcMode?.StartsWith("1") ?? true;
|
||
|
||
/// <summary>算尾:InterestCalcMode 末位为 1;null/缺省视为算尾(EQD-6968 取价依赖判定的核心开关之一)。</summary>
|
||
[JsonIgnore]
|
||
public bool CalcLast => InterestCalcMode?.EndsWith("1") ?? true;
|
||
|
||
/// <summary>
|
||
/// 是否罚息(EQD-6977):提前终止平仓时利息端按持有至到期计息的簿记默认值。
|
||
/// 平仓页默认带出此值、可修改,以平仓时选择为准(当次选择经 UnwindData.IsPenaltyInterest 走请求,不回写)。
|
||
/// 存量 JSON 无此键 → 反序列化默认 false("否"),零回填。
|
||
/// </summary>
|
||
public bool IsPenaltyInterest { get; set; }
|
||
|
||
/// <summary>
|
||
///多空组合浮动端 收取方向 1:收取,2:支付
|
||
/// </summary>
|
||
public int Direction { get; set; }
|
||
|
||
/// <summary>
|
||
/// 结算规则 0 T+0 1 T+1
|
||
/// </summary>
|
||
public int SettlementRules { get; set; } = 0;
|
||
|
||
/// <summary>
|
||
/// 派息金额支付日 0到期结算日 1派息日+0 2派息日+1 3派息日+2
|
||
/// </summary>
|
||
public int DividendPayDate { get; set; } = 1;
|
||
|
||
}
|
||
}
|