china_bond_valuation 来源恒为中债估值(聚源仅转发,无人手工维护),不再按 JSID 推断系统/人工;eod 两表仍用自带 DataSource(人工/系统)。债券被人工改动(update_user 非空)时,日终列表来源列显示操作人姓名,否则显示中债估值;操作人经已有 create_user/update_user 列溯源(零 DDL)。手工上传 xlsx 的债券分支补戳操作人,与表单编辑口径一致。配套单测 EodPriceDtoTest / EodPriceGoldenReplayTest + golden JSON。
136 lines
3.7 KiB
C#
136 lines
3.7 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace YLErp.DBModels
|
|
{
|
|
/// <summary>
|
|
/// 日终价格基础表
|
|
/// </summary>
|
|
public class EodPriceBase : DBModelWithOperator
|
|
{
|
|
public static string 人工 = "人工";
|
|
public static string 系统 = "系统";
|
|
/// <summary>中债估值(china_bond_valuation 的来源恒为此值;聚源仅转发,无人手工维护)</summary>
|
|
public static string 中债估值 = "中债估值";
|
|
|
|
/// <summary>
|
|
/// 合约代码
|
|
/// </summary>
|
|
[DisplayName("合约代码")]
|
|
public virtual string UnderlyingCode { set; get; }
|
|
|
|
/// <summary>
|
|
/// 估值日期
|
|
/// </summary>
|
|
[DisplayName("估值日期")]
|
|
public DateTime ValueDate { set; get; }
|
|
|
|
/// <summary>
|
|
/// 收盘价
|
|
/// </summary>
|
|
[DisplayName("收盘价")]
|
|
public double ClosePrice { set; get; }
|
|
|
|
/// <summary>
|
|
/// 结算价
|
|
/// </summary>
|
|
[DisplayName("结算价")]
|
|
public virtual double SettlePrice { set; get; }
|
|
|
|
/// <summary>
|
|
/// 参考价
|
|
/// </summary>
|
|
[DisplayName("参考价")]
|
|
public virtual double? ReferencePrice { set; get; }
|
|
|
|
/// <summary>
|
|
/// 最高价
|
|
/// </summary>
|
|
[DisplayName("最高价")]
|
|
public virtual double? HighPrice { set; get; }
|
|
|
|
/// <summary>
|
|
/// 最低价
|
|
/// </summary>
|
|
[DisplayName("最低价")]
|
|
public virtual double? LowPrice { set; get; }
|
|
|
|
/// <summary>
|
|
/// 数据来源
|
|
/// </summary>
|
|
[DisplayName("数据来源")]
|
|
public virtual string DataSource { set; get; }
|
|
|
|
/// <summary>
|
|
/// 源数据时间
|
|
/// </summary>
|
|
[DisplayName("源数据时间")]
|
|
public string SourceTime { set; get; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public double GetPrice(SettlementTypeEnum type)
|
|
{
|
|
switch (type)
|
|
{
|
|
default:
|
|
case SettlementTypeEnum.ClosePrice:
|
|
return ClosePrice;
|
|
case SettlementTypeEnum.ReferencePrice:
|
|
return ReferencePrice ?? ClosePrice;
|
|
case SettlementTypeEnum.SettlePrice:
|
|
return SettlePrice;
|
|
}
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{ValueDate:yyyy-MM-dd}--{UnderlyingCode}--{ClosePrice}";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 期货日终价格表
|
|
/// </summary>
|
|
[Table("eod_commodity_future_price")]
|
|
public class eod_commodity_future_price : EodPriceBase
|
|
{
|
|
[DisplayName("标的信息")]
|
|
public int? UnderlyingId { get; set; }
|
|
|
|
[Column("FutureContractId"), Required]
|
|
public override string UnderlyingCode { get; set; }
|
|
|
|
public eod_commodity_future_price Clone()
|
|
{
|
|
return (eod_commodity_future_price)MemberwiseClone();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 股票日终价格表
|
|
/// </summary>
|
|
[Table("eod_stock_price")]
|
|
public class eod_stock_price : EodPriceBase
|
|
{
|
|
/// <summary>
|
|
/// 标的状态:正常 停牌 退市
|
|
/// </summary>
|
|
[Column("UnderlyingStatus")]
|
|
[DisplayName("运行状态")]
|
|
public string UnderlyingStatus { get; set; }
|
|
|
|
[Column("StockId")]
|
|
public override string UnderlyingCode { get; set; }
|
|
|
|
[NotMapped]
|
|
public override double SettlePrice => 0;
|
|
|
|
public eod_stock_price Clone()
|
|
{
|
|
return (eod_stock_price)MemberwiseClone();
|
|
}
|
|
}
|
|
}
|