#EQD-6948 国联民生-实现保证金规则(2)追保金额的产生与收盘计算 ETF 子类分档(转债ETF/科创债ETF)
This commit is contained in:
@@ -299,7 +299,8 @@ namespace YLErp.Web.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
//区间追保结构 + 按资产类型分类时,期限档仅允许"允许分期限档的资产类型"(本期仅利率债)配置,防止信用债等非分档类型误配期限档;
|
||||
//区间追保结构 + 按资产类型分类时,期限档仅允许"允许分期限档的资产类型"(利率债)或"允许分档的 ETF 子类"
|
||||
//(可转债 ETF/科创债 ETF,行 UnderlyingType=基金 + EtfKind=子类,不加枚举位)配置,防止非分档类型误配期限档;
|
||||
//该校验按行生效,与明细行数无关(单行明细同样拦截);
|
||||
//按严格掩码判定:行标的类型位必须全部落在可分档类型内(混合标志位如 利率债|信用债 配期限档同样拦截,与取数侧整行期限档过滤语义一致);
|
||||
//UnderlyingType 为空的通配行允许配期限档(取数侧期限档过滤在前、通配匹配在后,语义自洽)
|
||||
@@ -307,13 +308,34 @@ namespace YLErp.Web.Controllers
|
||||
&& marginTemplate.UnderlyingSeperateType == (int)UnderlyingSeperateTypeEnum.CustomInstrumentType)
|
||||
{
|
||||
var enabledMask = ConsMarginTerm.TermTierEnabledUnderlyingTypes.Aggregate(UnderlyingTypeEnum.None, (a, t) => a | t);
|
||||
var tierEnabledEtfKinds = ConsMarginTerm.TermTierEnabledEtfKinds;
|
||||
foreach (var detail in marginTemplate.Details)
|
||||
{
|
||||
var etfKind = detail.SpanConfig?.EtfKind;
|
||||
//ETF 子类行:仅允许纯基金行(配置页子类选择器也只在纯基金区块出现)
|
||||
if (!string.IsNullOrEmpty(etfKind) && detail.UnderlyingType != UnderlyingTypeEnum.Fund)
|
||||
{
|
||||
throw new Exception("配置了 ETF 子类(" + etfKind + ")的参数组资产类型必须为 基金及基金专户");
|
||||
}
|
||||
var isTierEnabledEtfKind = tierEnabledEtfKinds.Contains(etfKind ?? "");
|
||||
if (!string.IsNullOrEmpty(detail.SpanConfig?.BondTerm)
|
||||
&& (detail.UnderlyingType & ~enabledMask) != UnderlyingTypeEnum.None)
|
||||
&& (detail.UnderlyingType & ~enabledMask) != UnderlyingTypeEnum.None
|
||||
&& !isTierEnabledEtfKind)
|
||||
{
|
||||
throw new Exception("标的类型不允许配置期限档:" + UnderlyingTypeUtil.GetDesc(detail.UnderlyingType));
|
||||
}
|
||||
//分档 ETF 子类必须配期限档(区块固定4档),其余子类行禁配期限档
|
||||
if (!string.IsNullOrEmpty(etfKind))
|
||||
{
|
||||
if (isTierEnabledEtfKind && string.IsNullOrEmpty(detail.SpanConfig?.BondTerm))
|
||||
{
|
||||
throw new Exception("ETF 子类 " + etfKind + " 为分期限档类型,参数行必须配置期限档");
|
||||
}
|
||||
if (!isTierEnabledEtfKind && !string.IsNullOrEmpty(detail.SpanConfig?.BondTerm))
|
||||
{
|
||||
throw new Exception("ETF 子类 " + etfKind + " 不分期限档,参数行不能配置期限档");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user