95 lines
3.3 KiB
C#
95 lines
3.3 KiB
C#
using YLErp.Enums;
|
|
|
|
namespace YLErp.DBModels
|
|
{
|
|
/// <summary>
|
|
/// 保证金配置期限常量定义(利率债TRS)
|
|
/// </summary>
|
|
public static class ConsMarginTerm
|
|
{
|
|
/// <summary>
|
|
/// 允许配置期限档(SpanConfig.BondTerm)的标的资产类型标志位。
|
|
/// 区间追保结构"按资产类型分类"时,仅这些类型允许设置非空期限档;
|
|
/// 本期仅含 利率债(TBonds=1<<4=16);ETF 子类分档能力见 TermTierEnabledEtfKinds。
|
|
/// </summary>
|
|
public static readonly UnderlyingTypeEnum[] TermTierEnabledUnderlyingTypes =
|
|
{
|
|
UnderlyingTypeEnum.TBonds
|
|
};
|
|
|
|
/// <summary>
|
|
/// 允许配置期限档的 ETF 子类白名单(来自数据字典"ETF 子类")。
|
|
/// 选择这些子类的 ETF 区块按固定4档展开(同利率债);其余子类/不区分的 ETF 区块单套参数、不分档。
|
|
/// 取值与 underlying_manager.EtfSubType 字典项一致,由标的维护页维护。
|
|
/// 注意:分档 ETF 子类行的 UnderlyingType 仍为 基金(32768),不走 TermTierEnabledUnderlyingTypes 位掩码(§1.2 决策:不再加枚举位)。
|
|
/// </summary>
|
|
public static readonly List<string> TermTierEnabledEtfKinds = new List<string>
|
|
{
|
|
"可转债 ETF",
|
|
"科创债 ETF"
|
|
};
|
|
|
|
/// <summary>
|
|
/// 判断 EtfKind 是否允许分档(在 TermTierEnabledEtfKinds 白名单内)。
|
|
/// </summary>
|
|
public static bool IsTermTierEnabledEtfKind(string etfKind)
|
|
{
|
|
return !string.IsNullOrEmpty(etfKind) && TermTierEnabledEtfKinds.Contains(etfKind);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 5年以下(同时也是兜底默认期限)
|
|
/// </summary>
|
|
public const string UnderFiveYear = "<5y";
|
|
|
|
/// <summary>
|
|
/// 5年-10年
|
|
/// </summary>
|
|
public const string FiveToTenYear = "5y-10y";
|
|
|
|
/// <summary>
|
|
/// 10年-30年
|
|
/// </summary>
|
|
public const string TenToThirtyYear = "10y-30y";
|
|
|
|
/// <summary>
|
|
/// 30年以上
|
|
/// </summary>
|
|
public const string OverThirtyYear = ">30y";
|
|
|
|
/// <summary>
|
|
/// 所有允许的期限值
|
|
/// </summary>
|
|
public static readonly List<string> AllowedTerms = new List<string>
|
|
{
|
|
UnderFiveYear,
|
|
FiveToTenYear,
|
|
TenToThirtyYear,
|
|
OverThirtyYear
|
|
};
|
|
|
|
/// <summary>
|
|
/// 验证期限是否有效
|
|
/// </summary>
|
|
public static bool IsValidTerm(string term)
|
|
{
|
|
return AllowedTerms.Contains(term ?? string.Empty);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取期限的显示名称(与设置页 bondTermLabel 同口径的开闭区间文案:≤5y / (5y-10y] / (10y-30y] / >30y;空=全部兜底档)
|
|
/// </summary>
|
|
public static string GetDisplayName(string term)
|
|
{
|
|
return term switch
|
|
{
|
|
UnderFiveYear => "≤5y",
|
|
FiveToTenYear => "(5y-10y]",
|
|
TenToThirtyYear => "(10y-30y]",
|
|
OverThirtyYear => ">30y",
|
|
_ => string.IsNullOrEmpty(term) ? "全部" : term
|
|
};
|
|
}
|
|
}
|
|
}
|