feat:增加债券借贷费率表的内存读取代码

This commit is contained in:
ruisu
2026-08-14 15:14:32 +08:00
parent 31691f08db
commit 0722da1149
3 changed files with 97 additions and 0 deletions
@@ -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; }
}
}
+1
View File
@@ -255,6 +255,7 @@ namespace YLErp.BLL
public DbSet<eod_trade_risk_hedgevol_s> eod_trade_risk_hedgevol_s { get; set; }
public DbSet<eod_trade_risk_openvol_s> eod_trade_risk_openvol_s { get; set; }
public DbSet<eod_currency_rate> eod_currency_rate { get; set; }
public DbSet<eod_bond_lending_rate> eod_bond_lending_rate { get; set; }
public DbSet<StockBlackWhite> Stock_BlackWhite { get; set; }
public DbSet<SalesCommissionInfo> SalesCommissionInfo { get; set; }
public DbSet<SalesCommissionDetail> SalesCommissionDetail { get; set; }
@@ -269,6 +269,36 @@ namespace YLErp.Modules.DataProviderModule
return bondPrice;
}
/// <summary>
/// 获取债券借贷费率最新行情
/// </summary>
/// <param name="valueDate"></param>
/// <param name="underlyingSecurityId"></param>
/// <returns></returns>
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();
}
/// <summary>
/// 尝试获取债券借贷费率最新行情
/// </summary>
/// <param name="valueDate"></param>
/// <param name="underlyingSecurityId"></param>
/// <param name="bondLendingRate"></param>
/// <returns></returns>
public static bool TryGetBondLendingRate(DateTime valueDate, string underlyingSecurityId, out eod_bond_lending_rate bondLendingRate)
{
return (bondLendingRate = GetBondLendingRate(valueDate, underlyingSecurityId)) != null;
}
/// <summary>
/// 获取标的收盘价格
/// </summary>
/// <param name="code">标的代码</param>