From 0722da1149b32ed8d6745e3ced3911db627792b6 Mon Sep 17 00:00:00 2001 From: ruisu Date: Fri, 14 Aug 2026 15:14:32 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=80=BA?= =?UTF-8?q?=E5=88=B8=E5=80=9F=E8=B4=B7=E8=B4=B9=E7=8E=87=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E5=86=85=E5=AD=98=E8=AF=BB=E5=8F=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DBModels/eod_bond_lending_rate.cs | 66 +++++++++++++++++++ YLErpDAL/DataBase/YLContext.cs | 1 + .../EodPriceQueryService.cs | 30 +++++++++ 3 files changed, 97 insertions(+) create mode 100644 Framework/YLErp.Core/DBModels/eod_bond_lending_rate.cs 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; + } + /// /// 获取标的收盘价格 /// /// 标的代码