/// <summary> /// Creates metadata for a surface providing a SABR expiry-tenor parameter. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// The y-values represent tenor year fractions. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <param name="dayCount"> the day count </param> /// <param name="zType"> the z-value type, which must be one of the four SABR values </param> /// <returns> the surface metadata </returns> public static SurfaceMetadata sabrParameterByExpiryTenor(SurfaceName name, DayCount dayCount, ValueType zType) { if (!zType.Equals(ValueType.SABR_ALPHA) && !zType.Equals(ValueType.SABR_BETA) && !zType.Equals(ValueType.SABR_RHO) && !zType.Equals(ValueType.SABR_NU)) { throw new System.ArgumentException("SABR z-value type must be SabrAlpha, SabrBeta, SabrRho or SabrNu"); } return(DefaultSurfaceMetadata.builder().surfaceName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).zValueType(zType).dayCount(dayCount).build()); }
public virtual void test_of() { SurfaceName test = SurfaceName.of("Foo"); assertEquals(test.Name, "Foo"); assertEquals(test.MarketDataType, typeof(Surface)); assertEquals(test.ToString(), "Foo"); assertEquals(test.CompareTo(SurfaceName.of("Goo")) < 0, true); }
/// <summary> /// Restricted copy constructor. /// </summary> /// <param name="beanToCopy"> the bean to copy from </param> internal DefaultSurfaceMetadataBuilder(DefaultSurfaceMetadata beanToCopy) { this.surfaceName_Renamed = beanToCopy.SurfaceName; this.xValueType_Renamed = beanToCopy.XValueType; this.yValueType_Renamed = beanToCopy.YValueType; this.zValueType_Renamed = beanToCopy.ZValueType; //JAVA TO C# CONVERTER TODO TASK: There is no .NET Dictionary equivalent to the Java 'putAll' method: this.info.putAll(beanToCopy.Info); this.parameterMetadata_Renamed = beanToCopy.ParameterMetadata.orElse(null); }
//----------------------------------------------------------------------- /// <summary> /// Sets the surface name. /// </summary> /// <param name="surfaceName"> the surface name </param> /// <returns> this, for chaining </returns> public DefaultSurfaceMetadataBuilder surfaceName(string surfaceName) { this.surfaceName_Renamed = SurfaceName.of(surfaceName); return(this); }
/// <summary> /// Creates metadata for a surface providing Black expiry-strike volatility. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// The y-values represent strike /// The z-values represent Black volatility. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <param name="dayCount"> the day count </param> /// <returns> the surface metadata </returns> public static SurfaceMetadata blackVolatilityByExpiryStrike(SurfaceName name, DayCount dayCount) { return(DefaultSurfaceMetadata.builder().surfaceName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.STRIKE).zValueType(ValueType.BLACK_VOLATILITY).dayCount(dayCount).build()); }
//------------------------------------------------------------------------- /// <summary> /// Creates metadata for a surface providing Black expiry-strike volatility. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// The y-values represent strike /// The z-values represent Black volatility. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <param name="dayCount"> the day count </param> /// <returns> the surface metadata </returns> public static SurfaceMetadata blackVolatilityByExpiryStrike(string name, DayCount dayCount) { return(blackVolatilityByExpiryStrike(SurfaceName.of(name), dayCount)); }
//------------------------------------------------------------------------- /// <summary> /// Creates metadata for a surface providing a SABR expiry-tenor parameter. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// The y-values represent tenor year fractions. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <param name="dayCount"> the day count </param> /// <param name="zType"> the z-value type, which must be one of the four SABR values </param> /// <returns> the surface metadata </returns> public static SurfaceMetadata sabrParameterByExpiryTenor(string name, DayCount dayCount, ValueType zType) { return(sabrParameterByExpiryTenor(SurfaceName.of(name), dayCount, zType)); }
/// <summary> /// Creates metadata for a surface providing Normal expiry-simple moneyness volatility. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// The y-values represent simple moneyness. /// The z-values represent Normal volatility. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <param name="dayCount"> the day count </param> /// <param name="moneynessType"> the moneyness type, prices or rates </param> /// <returns> the surface metadata </returns> public static SurfaceMetadata normalVolatilityByExpirySimpleMoneyness(SurfaceName name, DayCount dayCount, MoneynessType moneynessType) { return(DefaultSurfaceMetadata.builder().surfaceName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.SIMPLE_MONEYNESS).zValueType(ValueType.NORMAL_VOLATILITY).dayCount(dayCount).addInfo(SurfaceInfoType.MONEYNESS_TYPE, moneynessType).build()); }
/// <summary> /// Creates metadata for a surface providing Normal expiry-tenor volatility. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// The y-values represent tenor year fractions. /// The z-values represent Normal volatility. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <param name="dayCount"> the day count </param> /// <returns> the surface metadata </returns> public static SurfaceMetadata normalVolatilityByExpiryTenor(SurfaceName name, DayCount dayCount) { return(DefaultSurfaceMetadata.builder().surfaceName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).zValueType(ValueType.NORMAL_VOLATILITY).dayCount(dayCount).build()); }
//------------------------------------------------------------------------- /// <summary> /// Creates metadata for a surface providing Normal expiry-tenor volatility. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// The y-values represent tenor year fractions. /// The z-values represent Normal volatility. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <param name="dayCount"> the day count </param> /// <returns> the surface metadata </returns> public static SurfaceMetadata normalVolatilityByExpiryTenor(string name, DayCount dayCount) { return(normalVolatilityByExpiryTenor(SurfaceName.of(name), dayCount)); }
/// <summary> /// Creates metadata for a surface providing Black expiry-log moneyness volatility. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// The y-values represent log-moneyness /// The z-values represent Black volatility. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <param name="dayCount"> the day count </param> /// <returns> the surface metadata </returns> public static SurfaceMetadata blackVolatilityByExpiryLogMoneyness(SurfaceName name, DayCount dayCount) { return(DefaultSurfaceMetadata.builder().surfaceName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.LOG_MONEYNESS).zValueType(ValueType.BLACK_VOLATILITY).dayCount(dayCount).build()); }
/// <summary> /// Creates the metadata. /// <para> /// No information will be available for the x-values, y-values, z-values or parameters. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <returns> the metadata </returns> public static DefaultSurfaceMetadata of(SurfaceName name) { return(new DefaultSurfaceMetadata(name, ValueType.UNKNOWN, ValueType.UNKNOWN, ValueType.UNKNOWN, ImmutableMap.of(), null)); }
//------------------------------------------------------------------------- /// <summary> /// Creates the metadata. /// <para> /// No information will be available for the x-values, y-values, z-values or parameters. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <returns> the metadata </returns> public static DefaultSurfaceMetadata of(string name) { return(of(SurfaceName.of(name))); }
/// <summary> /// Creates a constant surface with a specific value. /// </summary> /// <param name="name"> the surface name </param> /// <param name="zValue"> the constant z-value </param> /// <returns> the surface </returns> public static ConstantSurface of(SurfaceName name, double zValue) { return(new ConstantSurface(DefaultSurfaceMetadata.of(name), zValue)); }
//------------------------------------------------------------------------- /// <summary> /// Creates a constant surface with a specific value. /// </summary> /// <param name="name"> the surface name </param> /// <param name="zValue"> the constant z-value </param> /// <returns> the surface </returns> public static ConstantSurface of(string name, double zValue) { return(of(SurfaceName.of(name), zValue)); }
/// <summary> /// Sets the surface name. /// </summary> /// <param name="surfaceName"> the surface name </param> /// <returns> this, for chaining </returns> public DefaultSurfaceMetadataBuilder surfaceName(SurfaceName surfaceName) { this.surfaceName_Renamed = ArgChecker.notNull(surfaceName, "surfaceName"); return(this); }
//------------------------------------------------------------------------- /// <summary> /// Creates metadata for a surface providing Normal expiry-simple moneyness volatility. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// The y-values represent simple moneyness. /// The z-values represent Normal volatility. /// /// </para> /// </summary> /// <param name="name"> the surface name </param> /// <param name="dayCount"> the day count </param> /// <param name="moneynessType"> the moneyness type, prices or rates </param> /// <returns> the surface metadata </returns> public static SurfaceMetadata normalVolatilityByExpirySimpleMoneyness(string name, DayCount dayCount, MoneynessType moneynessType) { return(normalVolatilityByExpirySimpleMoneyness(SurfaceName.of(name), dayCount, moneynessType)); }
//------------------------------------------------------------------------- public virtual void coverage() { DefaultSurfaceMetadata test = DefaultSurfaceMetadata.of(SURFACE_NAME); coverImmutableBean(test); DefaultSurfaceMetadata test2 = DefaultSurfaceMetadata.builder().surfaceName(SurfaceName.of("Test")).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.DISCOUNT_FACTOR).zValueType(ValueType.ZERO_RATE).dayCount(ACT_365F).parameterMetadata(ParameterMetadata.empty()).build(); coverBeanEquals(test, test2); }