All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.quantlib.Swaption Maven / Gradle / Ivy

There is a newer version: 1.36.0
Show newest version
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (https://www.swig.org).
 * Version 4.2.1
 *
 * Do not make changes to this file unless you know what you are doing - modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.quantlib;

public class Swaption extends Option implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
  private transient long swigCPtr;
  private transient boolean swigCMemOwnDerived;

  protected Swaption(long cPtr, boolean cMemoryOwn) {
    super(QuantLibJNI.Swaption_SWIGSmartPtrUpcast(cPtr), true);
    swigCMemOwnDerived = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(Swaption obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void swigSetCMemOwn(boolean own) {
    swigCMemOwnDerived = own;
    super.swigSetCMemOwn(own);
  }

  @SuppressWarnings({"deprecation", "removal"})
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwnDerived) {
        swigCMemOwnDerived = false;
        QuantLibJNI.delete_Swaption(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public Swaption(FixedVsFloatingSwap swap, Exercise exercise, Settlement.Type type, Settlement.Method settlementMethod) {
    this(QuantLibJNI.new_Swaption__SWIG_0(FixedVsFloatingSwap.getCPtr(swap), swap, Exercise.getCPtr(exercise), exercise, type.swigValue(), settlementMethod.swigValue()), true);
  }

  public Swaption(FixedVsFloatingSwap swap, Exercise exercise, Settlement.Type type) {
    this(QuantLibJNI.new_Swaption__SWIG_1(FixedVsFloatingSwap.getCPtr(swap), swap, Exercise.getCPtr(exercise), exercise, type.swigValue()), true);
  }

  public Swaption(FixedVsFloatingSwap swap, Exercise exercise) {
    this(QuantLibJNI.new_Swaption__SWIG_2(FixedVsFloatingSwap.getCPtr(swap), swap, Exercise.getCPtr(exercise), exercise), true);
  }

  public Settlement.Type settlementType() {
    return Settlement.Type.swigToEnum(QuantLibJNI.Swaption_settlementType(swigCPtr, this));
  }

  public Settlement.Method settlementMethod() {
    return Settlement.Method.swigToEnum(QuantLibJNI.Swaption_settlementMethod(swigCPtr, this));
  }

  public Swap.Type type() {
    return Swap.Type.swigToEnum(QuantLibJNI.Swaption_type(swigCPtr, this));
  }

  public FixedVsFloatingSwap underlying() {
    long cPtr = QuantLibJNI.Swaption_underlying(swigCPtr, this);
    return (cPtr == 0) ? null : new FixedVsFloatingSwap(cPtr, true);
  }

  public VanillaSwap underlyingSwap() {
    long cPtr = QuantLibJNI.Swaption_underlyingSwap(swigCPtr, this);
    return (cPtr == 0) ? null : new VanillaSwap(cPtr, true);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol, VolatilityType type, double displacement, Swaption.PriceType priceType) {
    return QuantLibJNI.Swaption_impliedVolatility__SWIG_0(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations, minVol, maxVol, type.swigValue(), displacement, priceType.swigValue());
  }

  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol, VolatilityType type, double displacement) {
    return QuantLibJNI.Swaption_impliedVolatility__SWIG_1(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations, minVol, maxVol, type.swigValue(), displacement);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol, VolatilityType type) {
    return QuantLibJNI.Swaption_impliedVolatility__SWIG_2(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations, minVol, maxVol, type.swigValue());
  }

  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations, double minVol, double maxVol) {
    return QuantLibJNI.Swaption_impliedVolatility__SWIG_3(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations, minVol, maxVol);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations, double minVol) {
    return QuantLibJNI.Swaption_impliedVolatility__SWIG_4(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations, minVol);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy, long maxEvaluations) {
    return QuantLibJNI.Swaption_impliedVolatility__SWIG_5(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy, maxEvaluations);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess, double accuracy) {
    return QuantLibJNI.Swaption_impliedVolatility__SWIG_6(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess, accuracy);
  }

  public double impliedVolatility(double price, YieldTermStructureHandle discountCurve, double guess) {
    return QuantLibJNI.Swaption_impliedVolatility__SWIG_7(swigCPtr, this, price, YieldTermStructureHandle.getCPtr(discountCurve), discountCurve, guess);
  }

  public double vega() {
    return QuantLibJNI.Swaption_vega(swigCPtr, this);
  }

  public double delta() {
    return QuantLibJNI.Swaption_delta(swigCPtr, this);
  }

  public double annuity() {
    return QuantLibJNI.Swaption_annuity(swigCPtr, this);
  }

  public double forwardPrice() {
    return QuantLibJNI.Swaption_forwardPrice(swigCPtr, this);
  }

  public final static class PriceType {
    public final static Swaption.PriceType Spot = new Swaption.PriceType("Spot");
    public final static Swaption.PriceType Forward = new Swaption.PriceType("Forward");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static PriceType swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + PriceType.class + " with value " + swigValue);
    }

    private PriceType(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private PriceType(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private PriceType(String swigName, PriceType swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static PriceType[] swigValues = { Spot, Forward };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy