feat(settlement): 添加标的类型判断逻辑支持价格表分流
- 在ConsGlobal中为所有标的类型常量添加中文注释说明 - 新增UseStockPriceTable方法用于判断标的类型是否使用股票价格表 - 修改SettlementPriceImportService中的价格表分流逻辑 - 添加单元测试验证股指期货、基金等进入股票价格表的逻辑 - 确保Shibor、利率收益率和债券指数进入正确的商品期货价格表
This commit is contained in:
@@ -109,33 +109,33 @@ namespace YLErp
|
||||
/// </summary>
|
||||
public static class InstrumentType
|
||||
{
|
||||
public const string Stock = "Stock";
|
||||
public const string StockIndex = "StockIndex";
|
||||
public const string StockIF = "StockIF";
|
||||
public const string CommoditySpot = "CommoditySpot";
|
||||
public const string CommodityFutures = "CommodityFutures";
|
||||
public const string NewOtcStock = "NewOtcStock";
|
||||
public const string HKStock = "HKStock";
|
||||
public const string HKStockIndex = "HKStockIndex";
|
||||
public const string Fund = "Fund";
|
||||
public const string TBonds = "TBonds";
|
||||
public const string CreditBonds = "CreditBonds"; //信用债
|
||||
public const string OtherBonds = "OtherBonds"; //其它债券
|
||||
public const string Bonds = "Bond"; //债券
|
||||
public const string GoldFutures = "GoldFutures";
|
||||
public const string TBFutures = "TBFutures";
|
||||
public const string OtherFutures = "OtherFutures";
|
||||
public const string GoldSpot = "GoldSpot";
|
||||
public const string OtherSpot = "OtherSpot";
|
||||
public const string AbroadFutures = "AbroadFutures";
|
||||
public const string AbroadSpot = "AbroadSpot";
|
||||
public const string AbroadStock = "AbroadStock";
|
||||
public const string AbroadStockIndex = "AbroadStockIndex";
|
||||
public const string ExRate = "ExRate";
|
||||
public const string Shibor = "Shibor";
|
||||
public const string FixingRepoRate = "FixingRepoRate";
|
||||
public const string OtherRate = "OtherRate";
|
||||
public const string RateYield = "RateYield"; //利率收益率
|
||||
public const string Stock = "Stock"; // 股票
|
||||
public const string StockIndex = "StockIndex"; // 股指
|
||||
public const string StockIF = "StockIF"; // 股指期货
|
||||
public const string CommoditySpot = "CommoditySpot"; // 商品现货
|
||||
public const string CommodityFutures = "CommodityFutures"; // 商品期货
|
||||
public const string NewOtcStock = "NewOtcStock"; // 新三板挂牌股票
|
||||
public const string HKStock = "HKStock"; // 香港股票
|
||||
public const string HKStockIndex = "HKStockIndex"; // 香港股指
|
||||
public const string Fund = "Fund"; // 基金及基金专户
|
||||
public const string TBonds = "TBonds"; // 利率债
|
||||
public const string CreditBonds = "CreditBonds"; // 信用债
|
||||
public const string OtherBonds = "OtherBonds"; // 其它债券
|
||||
public const string Bonds = "Bond"; // 债券
|
||||
public const string GoldFutures = "GoldFutures"; // 黄金期货
|
||||
public const string TBFutures = "TBFutures"; // 国债期货
|
||||
public const string OtherFutures = "OtherFutures"; // 其他期货
|
||||
public const string GoldSpot = "GoldSpot"; // 黄金现货
|
||||
public const string OtherSpot = "OtherSpot"; // 其他现货
|
||||
public const string AbroadFutures = "AbroadFutures"; // 境外期货
|
||||
public const string AbroadSpot = "AbroadSpot"; // 境外现货
|
||||
public const string AbroadStock = "AbroadStock"; // 境外股票
|
||||
public const string AbroadStockIndex = "AbroadStockIndex"; // 境外股指
|
||||
public const string ExRate = "ExRate"; // 汇率
|
||||
public const string Shibor = "Shibor"; // Shibor
|
||||
public const string FixingRepoRate = "FixingRepoRate"; // 银行间回购定盘
|
||||
public const string OtherRate = "OtherRate"; // 其他利率
|
||||
public const string RateYield = "RateYield"; // 利率收益率
|
||||
public const string BondIndex = "BondIndex"; // 债券指数
|
||||
|
||||
//public const string OtherUnderlying = "OtherUnderlying";
|
||||
|
||||
@@ -85,6 +85,21 @@ namespace YLErp.Modules.EodModule
|
||||
|
||||
#endregion
|
||||
|
||||
#region 手工上传日终价格落表分流
|
||||
|
||||
[TestMethod]
|
||||
[Description("股指期货和基金进入股票价格表,Shibor、利率收益率和债券指数进入商品期货价格表")]
|
||||
public void 手工上传_按标的类型选择股票价格表()
|
||||
{
|
||||
Assert.IsTrue(SettlementPriceImportService.UseStockPriceTable(ConsGlobal.InstrumentType.StockIF));
|
||||
Assert.IsTrue(SettlementPriceImportService.UseStockPriceTable(ConsGlobal.InstrumentType.Fund));
|
||||
Assert.IsFalse(SettlementPriceImportService.UseStockPriceTable(ConsGlobal.InstrumentType.Shibor));
|
||||
Assert.IsFalse(SettlementPriceImportService.UseStockPriceTable(ConsGlobal.InstrumentType.RateYield));
|
||||
Assert.IsFalse(SettlementPriceImportService.UseStockPriceTable(ConsGlobal.InstrumentType.BondIndex));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 问题3:债券数据来源按是否手工改过区分"人工"/"系统"
|
||||
|
||||
[TestMethod]
|
||||
|
||||
@@ -14,6 +14,12 @@ namespace YLErp.Modules.EodModule
|
||||
|
||||
}
|
||||
|
||||
public static bool UseStockPriceTable(string instrumentType)
|
||||
{
|
||||
return ConsGlobal.InstrumentType.EquityTypes().Contains(instrumentType)
|
||||
|| instrumentType == ConsGlobal.InstrumentType.Fund;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导入xlsx数据
|
||||
/// </summary>
|
||||
@@ -134,7 +140,7 @@ namespace YLErp.Modules.EodModule
|
||||
EodPriceService.StampBondOperator(eodPrice, UserId, eodPrice.id == 0);
|
||||
result.SuccessCount++;
|
||||
}
|
||||
else if (!underlying.CalcTypeIsStock())
|
||||
else if (!UseStockPriceTable(underlying.UnderlyingInstrumentType))
|
||||
{
|
||||
var eodPrice = DbContext.eod_commodity_future_price
|
||||
.FirstOrDefault(p => p.ValueDate == item.date && p.UnderlyingCode == underlying.UnderlyingCode);
|
||||
|
||||
Reference in New Issue
Block a user