refactor(funding-leg): 修复2个类名+补DividendCalc注释

采纳命名审查建议(优先级最高的2项):

1. UnderlyingFullPriceLeg → UnderlyingEntryFullPriceLeg
   补齐'期初(Entry)'——建仓时点全价, 非当前全价, 金融上是不同计息口径

2. FixedNotionalLeg → FixedAmountLeg
   去掉误导性的Notional——'固定值'是合同写死的数额, 不一定是名义本金,
   避免与ContractNotionalLeg的Notional概念撞车

3. DividendCalc 补充注释: 业务含义(债券票息+股票分红统一用Dividend)、
   税务口径(还原不含税再扣税)、命名保持理由

验证: 编译0错误, 全量507测试7失败(基线一致)。
This commit is contained in:
hjhan
2026-08-11 11:24:05 +08:00
parent d61ff742de
commit e35a738d2e
5 changed files with 30 additions and 20 deletions
@@ -22,7 +22,7 @@ namespace UnitTestProject.Modules.SwapModule.FundingLegs
[TestMethod]
public void _部分平仓_计息基数恒等于Fix()
{
var leg = new FixedNotionalLeg();
var leg = new FixedAmountLeg();
var r = leg.CalcNotional(Fix, Notional, LongNotional, ShortNotional, 0.5m);
Assert.AreEqual(Fix, r.ClosePrincipal, "平仓本金恒=Fix");
@@ -33,7 +33,7 @@ namespace UnitTestProject.Modules.SwapModule.FundingLegs
[TestMethod]
public void _全平_计息基数仍等于Fix()
{
var leg = new FixedNotionalLeg();
var leg = new FixedAmountLeg();
var r = leg.CalcNotional(Fix, Notional, LongNotional, ShortNotional, 1m);
Assert.AreEqual(Fix, r.ClosePrincipal);
}
@@ -78,7 +78,7 @@ namespace UnitTestProject.Modules.SwapModule.FundingLegs
[TestMethod]
public void _部分平仓_主路径公式同mode2()
{
var leg = new UnderlyingFullPriceLeg();
var leg = new UnderlyingEntryFullPriceLeg();
var r = leg.CalcNotional(Fix, Notional, LongNotional, ShortNotional, 0.5m);
Assert.AreEqual(50_000_000m, r.ClosePrincipal);
@@ -89,7 +89,7 @@ namespace UnitTestProject.Modules.SwapModule.FundingLegs
[TestMethod]
public void _全平_本金等于全额()
{
var leg = new UnderlyingFullPriceLeg();
var leg = new UnderlyingEntryFullPriceLeg();
var r = leg.CalcNotional(Fix, Notional, LongNotional, ShortNotional, 1m);
Assert.AreEqual(Notional, r.ClosePrincipal);
}
@@ -101,9 +101,9 @@ namespace UnitTestProject.Modules.SwapModule.FundingLegs
[TestMethod]
public void ()
{
Assert.AreEqual(InterestModeEnum., new FixedNotionalLeg().Mode);
Assert.AreEqual(InterestModeEnum., new FixedAmountLeg().Mode);
Assert.AreEqual(InterestModeEnum., new ContractNotionalLeg().Mode);
Assert.AreEqual(InterestModeEnum., new UnderlyingFullPriceLeg().Mode);
Assert.AreEqual(InterestModeEnum., new UnderlyingEntryFullPriceLeg().Mode);
}
#endregion
@@ -113,9 +113,9 @@ namespace UnitTestProject.Modules.SwapModule.FundingLegs
[TestMethod]
public void _返回各活跃mode的策略()
{
Assert.IsInstanceOfType(FundingLegStrategyFactory.Get(InterestModeEnum.), typeof(FixedNotionalLeg));
Assert.IsInstanceOfType(FundingLegStrategyFactory.Get(InterestModeEnum.), typeof(FixedAmountLeg));
Assert.IsInstanceOfType(FundingLegStrategyFactory.Get(InterestModeEnum.), typeof(ContractNotionalLeg));
Assert.IsInstanceOfType(FundingLegStrategyFactory.Get(InterestModeEnum.), typeof(UnderlyingFullPriceLeg));
Assert.IsInstanceOfType(FundingLegStrategyFactory.Get(InterestModeEnum.), typeof(UnderlyingEntryFullPriceLeg));
}
[TestMethod]