diff --git a/Framework/YLErp.Core/DBModels/eod_bond_lending_rate.cs b/Framework/YLErp.Core/DBModels/eod_bond_lending_rate.cs new file mode 100644 index 00000000..e1b9c54e --- /dev/null +++ b/Framework/YLErp.Core/DBModels/eod_bond_lending_rate.cs @@ -0,0 +1,66 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace YLErp.DBModels +{ + [Table("eod_bond_lending_rate")] + public class eod_bond_lending_rate + { + [Key] + public long id { get; set; } + + [DisplayName("业务唯一代码")] + public string RecordCode { get; set; } + + [DisplayName("业务日期")] + public DateTime ValueDate { get; set; } + + [DisplayName("标的债券代码")] + public string UnderlyingSecurityId { get; set; } + + [DisplayName("标的债券名称")] + public string UnderlyingSymbol { get; set; } + + [DisplayName("前收盘费率(%)")] + public decimal? PreCloseRate { get; set; } + + [DisplayName("前加权平均费率(%)")] + public decimal? PreWeightedAvgRate { get; set; } + + [DisplayName("开盘费率(%)")] + public decimal? OpenRate { get; set; } + + [DisplayName("最新费率(%)")] + public decimal? LatestRate { get; set; } + + [DisplayName("最高费率(%)")] + public decimal? HighRate { get; set; } + + [DisplayName("最低费率(%)")] + public decimal? LowRate { get; set; } + + [DisplayName("收盘费率(%)")] + public decimal? CloseRate { get; set; } + + [DisplayName("加权平均费率(%)")] + public decimal? WeightedAvgRate { get; set; } + + [DisplayName("成交量(元)")] + public decimal? TurnoverAmount { get; set; } + + [DisplayName("操作人ID")] + public int OptId { get; set; } + + [DisplayName("操作人名称")] + public string OptName { get; set; } + + [DisplayName("操作时间")] + public DateTime OptDate { get; set; } + + [DisplayName("数据来源")] + public string DataSource { get; set; } + + [DisplayName("源行情时间")] + public string SourceTime { get; set; } + } +} diff --git a/YLErpDAL/DataBase/YLContext.cs b/YLErpDAL/DataBase/YLContext.cs index 78936a0c..d5c8a160 100644 --- a/YLErpDAL/DataBase/YLContext.cs +++ b/YLErpDAL/DataBase/YLContext.cs @@ -255,6 +255,7 @@ namespace YLErp.BLL public DbSet eod_trade_risk_hedgevol_s { get; set; } public DbSet eod_trade_risk_openvol_s { get; set; } public DbSet eod_currency_rate { get; set; } + public DbSet eod_bond_lending_rate { get; set; } public DbSet Stock_BlackWhite { get; set; } public DbSet SalesCommissionInfo { get; set; } public DbSet SalesCommissionDetail { get; set; } diff --git a/YLErpDAL/Modules/DataProviderModule/EodPriceQueryService.cs b/YLErpDAL/Modules/DataProviderModule/EodPriceQueryService.cs index 7792e5e1..5b30494f 100644 --- a/YLErpDAL/Modules/DataProviderModule/EodPriceQueryService.cs +++ b/YLErpDAL/Modules/DataProviderModule/EodPriceQueryService.cs @@ -269,6 +269,36 @@ namespace YLErp.Modules.DataProviderModule return bondPrice; } /// + /// 获取债券借贷费率最新行情 + /// + /// + /// + /// + public static eod_bond_lending_rate GetBondLendingRate(DateTime valueDate, string underlyingSecurityId) + { + if (string.IsNullOrWhiteSpace(underlyingSecurityId)) + { + return null; + } + + using var db = DbContextFactory.GetYLDbContext(); + return db.eod_bond_lending_rate + .Where(x => x.UnderlyingSecurityId == underlyingSecurityId && x.ValueDate <= valueDate.Date) + .OrderByDescending(x => x.ValueDate) + .FirstOrDefault(); + } + /// + /// 尝试获取债券借贷费率最新行情 + /// + /// + /// + /// + /// + public static bool TryGetBondLendingRate(DateTime valueDate, string underlyingSecurityId, out eod_bond_lending_rate bondLendingRate) + { + return (bondLendingRate = GetBondLendingRate(valueDate, underlyingSecurityId)) != null; + } + /// /// 获取标的收盘价格 /// /// 标的代码