- 添加 EffectiveDate 字段用于标识真实除权生效日 - 实现公司行为价格系数和数量系数统一计算方法 - 增加基金除权回退和平仓基线恢复功能 - 完善除权日验证逻辑,确保真实除权日不早于股权登记日 - 重构平仓流程,支持按有效EOD基线重新计算损益和现金 - 添加基金拆合股和现金分红的特殊处理逻辑 - 增加单元测试验证各种公司行为场景下的正确性
114 lines
3.3 KiB
C#
114 lines
3.3 KiB
C#
using BaseOUDAL;
|
|
using System.ComponentModel;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace YLErp.DBModels
|
|
{
|
|
public static class ExDividendDataSources
|
|
{
|
|
public const string Manual = "Manual";
|
|
public const string MarketData = "MarketData";
|
|
}
|
|
|
|
[Table("ex_dividend_info")]
|
|
public class ex_dividend_info : DBModelWithOperator
|
|
{
|
|
public static string LogClass = "除权除息信息";
|
|
|
|
/// <summary>
|
|
/// 股权登记日
|
|
/// </summary>
|
|
[DisplayName("股权登记日")]
|
|
public DateTime? ExDividendDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 真实除权生效日。
|
|
/// ExDividendDate 表示登记日,EffectiveDate 表示从哪个 EOD 起数量/价格基线
|
|
/// 才允许切换到除权后口径;两者可能因周末、节假日或公告安排而不同。
|
|
/// </summary>
|
|
[DisplayName("真实除权日")]
|
|
public DateTime? EffectiveDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 税率
|
|
/// </summary>
|
|
[NotMapped]
|
|
public double DividRate { get; set; }
|
|
|
|
[DisplayName("标的资产")]
|
|
public int UnderlyingId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 标的资产码
|
|
/// </summary>
|
|
[DisplayName("标的资产码"), Required]
|
|
public string UnderlyingCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 派息金额
|
|
/// </summary>
|
|
[DisplayName("派息金额")]
|
|
public decimal GiveCashAmount { get; set; }
|
|
/// <summary>
|
|
/// 送股手数
|
|
/// </summary>
|
|
[DisplayName("送股股数")]
|
|
|
|
public decimal GiveShareAmount { get; set; }
|
|
/// <summary>
|
|
/// 配股手数
|
|
/// </summary>
|
|
[DisplayName("配股股数")]
|
|
|
|
public decimal RationedSharesAmount { get; set; }
|
|
/// <summary>
|
|
/// 配股手数
|
|
/// </summary>
|
|
[DisplayName("配股价")]
|
|
|
|
public decimal RationedSharesPrice { get; set; }
|
|
/// <summary>
|
|
/// 是否有效
|
|
/// </summary>
|
|
public bool ValidStatus { get; set; }
|
|
|
|
/// <summary>
|
|
/// Ownership of the record. Manual records always take precedence over imports.
|
|
/// </summary>
|
|
[DisplayName("数据来源"), Required, MaxLength(32)]
|
|
public string DataSource { get; set; } = ExDividendDataSources.Manual;
|
|
|
|
/// <summary>
|
|
/// Last update timestamp supplied by the market-data provider.
|
|
/// </summary>
|
|
[DisplayName("来源更新时间")]
|
|
public DateTime? SourceUpdatedAt { get; set; }
|
|
}
|
|
|
|
public class ex_dividend_infoReq : BaseSearchReq
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public int id { get; set; }
|
|
|
|
[DisplayName("标的资产")]
|
|
public int? UnderlyingId { get; set; }
|
|
|
|
/// <summary>
|
|
/// 标的资产码
|
|
/// </summary>
|
|
public string UnderlyingCode { get; set; }
|
|
/// <summary>
|
|
/// 股权登记日
|
|
/// </summary>
|
|
public DateTime? ExDividendDate { get; set; }
|
|
|
|
/// <summary>
|
|
/// 真实除权生效日。
|
|
/// </summary>
|
|
public DateTime? EffectiveDate { get; set; }
|
|
}
|
|
}
|