using YLErp.Commons;
namespace YLErp.Models
{
///
/// OTC格式化Model
///
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()
{
}
///
/// 标的价格|障碍价格|敲出价格
///
[OtcFormatConfig("标的价格")]
public OtcFormatOption umprice { get; set; } = 4;
///
/// 标的价格%|障碍价格%|敲出价格%
///
[OtcFormatConfig("标的价格%")]
public OtcFormatOptionPercent umpriceP
{
get => _umpriceP;
set
{
_umpriceP = value ?? 4;
umpricePR = _umpriceP.ToNonPercentOption();
}
}
///
/// 标的价格百分比真实数值
///
public OtcFormatOption umpricePR { get; private set; } = 6;
///
/// 权利金单价|票息|补偿金额
///
[OtcFormatConfig("权利金单价")]
public OtcFormatOption tradeSinglePrice { get; set; } = 3;
///
/// 期权费率|票息|补偿金额比例
///
[OtcFormatConfig("期权费率%")]
public OtcFormatOptionPercent premiumRateP
{
get => _premiumRateP;
set
{
_premiumRateP = value;
premiumRate = _premiumRateP.ToNonPercentOption();
}
}
///
/// 期权费率百分比真实数值
///
public OtcFormatOption premiumRate { get; private set; } = 6;
///
/// (固定为2位)权利金总价|平仓总额|PV|PNL
///
public OtcFormatOption tradePrice { get; } = 2;
[OtcFormatConfig("名义本金")]
public OtcFormatOption StockEqvNotional { get; set; } = 2;
///
/// 交易数量|平仓数量
///
[OtcFormatConfig("交易数量")]
public OtcFormatOption notional { get; set; } = 2;
///
/// 交易数量%|平仓数量%
///
[OtcFormatConfig("交易数量%")]
public OtcFormatOptionPercent notionalP { get; set; } = 2;
///
/// 波动率百分比真实数值
///
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; }
}
}