142 lines
4.3 KiB
C#
142 lines
4.3 KiB
C#
using YLErp.Commons;
|
|
|
|
namespace YLErp.Models
|
|
{
|
|
/// <summary>
|
|
/// OTC格式化Model
|
|
/// </summary>
|
|
public class OtcFormatModel
|
|
{
|
|
[OtcFormatConfig("交易和定价")]
|
|
public TradingFormat trading { get; set; } = new TradingFormat();
|
|
|
|
public class TradingFormat
|
|
{
|
|
private OtcFormatOptionPercent _volatilityP = 2;
|
|
private OtcFormatOptionPercent _umpriceP = 2;
|
|
private OtcFormatOptionPercent _premiumRateP = 4;
|
|
|
|
public TradingFormat()
|
|
{
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 标的价格|障碍价格|敲出价格
|
|
/// </summary>
|
|
[OtcFormatConfig("标的价格")]
|
|
public OtcFormatOption umprice { get; set; } = 4;
|
|
|
|
/// <summary>
|
|
/// 标的价格%|障碍价格%|敲出价格%
|
|
/// </summary>
|
|
[OtcFormatConfig("标的价格%")]
|
|
public OtcFormatOptionPercent umpriceP
|
|
{
|
|
get => _umpriceP;
|
|
set
|
|
{
|
|
_umpriceP = value ?? 4;
|
|
umpricePR = _umpriceP.ToNonPercentOption();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 标的价格百分比真实数值
|
|
/// </summary>
|
|
public OtcFormatOption umpricePR { get; private set; } = 6;
|
|
|
|
/// <summary>
|
|
/// 权利金单价|票息|补偿金额
|
|
/// </summary>
|
|
[OtcFormatConfig("权利金单价")]
|
|
public OtcFormatOption tradeSinglePrice { get; set; } = 3;
|
|
|
|
/// <summary>
|
|
/// 期权费率|票息|补偿金额比例
|
|
/// </summary>
|
|
[OtcFormatConfig("期权费率%")]
|
|
public OtcFormatOptionPercent premiumRateP
|
|
{
|
|
get => _premiumRateP;
|
|
set
|
|
{
|
|
_premiumRateP = value;
|
|
premiumRate = _premiumRateP.ToNonPercentOption();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 期权费率百分比真实数值
|
|
/// </summary>
|
|
public OtcFormatOption premiumRate { get; private set; } = 6;
|
|
|
|
/// <summary>
|
|
/// (固定为2位)权利金总价|平仓总额|PV|PNL
|
|
/// </summary>
|
|
public OtcFormatOption tradePrice { get; } = 2;
|
|
|
|
[OtcFormatConfig("名义本金")]
|
|
public OtcFormatOption StockEqvNotional { get; set; } = 2;
|
|
|
|
/// <summary>
|
|
/// 交易数量|平仓数量
|
|
/// </summary>
|
|
[OtcFormatConfig("交易数量")]
|
|
public OtcFormatOption notional { get; set; } = 2;
|
|
|
|
/// <summary>
|
|
/// 交易数量%|平仓数量%
|
|
/// </summary>
|
|
[OtcFormatConfig("交易数量%")]
|
|
public OtcFormatOptionPercent notionalP { get; set; } = 2;
|
|
|
|
/// <summary>
|
|
/// 波动率百分比真实数值
|
|
/// </summary>
|
|
public OtcFormatOption volatility { get; private set; } = 4;
|
|
|
|
[OtcFormatConfig("波动率%")]
|
|
public OtcFormatOptionPercent volatilityP
|
|
{
|
|
get => _volatilityP;
|
|
set
|
|
{
|
|
_volatilityP = value ?? 2;
|
|
volatility = _volatilityP.ToNonPercentOption();
|
|
}
|
|
}
|
|
|
|
[OtcFormatConfig("希腊字母值")]
|
|
public OtcFormatOption greek { get; set; } = 3;
|
|
|
|
OtcFormatOptionPercent _marginRateP = 4;
|
|
|
|
[OtcFormatConfig("预付金率%")]
|
|
public OtcFormatOptionPercent marginRateP
|
|
{
|
|
get => _marginRateP;
|
|
set
|
|
{
|
|
_marginRateP = value ?? 4;
|
|
marginRate = _marginRateP.ToNonPercentOption();
|
|
}
|
|
}
|
|
|
|
public OtcFormatOption marginRate { get; private set; } = 6;
|
|
}
|
|
}
|
|
|
|
|
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)]
|
|
public class OtcFormatConfigAttribute : Attribute
|
|
{
|
|
public OtcFormatConfigAttribute(string label)
|
|
{
|
|
Label = label ?? throw new ArgumentNullException(nameof(label));
|
|
}
|
|
|
|
public string Label { get; }
|
|
}
|
|
}
|