1
$\begingroup$

I am trying to price a two asset barrier option where each asset has its own barrier and both barriers have to be met for the payoff. The experimental TwoAssetBarrierOption class seems to accept only one Barrier. I tried the following so far but I am stuck at what Option class to use, or write a new one by extending from TwoAssetBarrierOption.

// set up dates
Calendar calendar = UnitedStates();
Date todaysDate(5, August, 2021);
Settings::instance().evaluationDate() = todaysDate;
Date settlementDate = todaysDate; //calendar.advance(todaysDate, 2, Days);
Date maturity(19, November, 2021);

//spx barrier option
BarrierOption spxoption(Barrier::DownIn, 4420.20, 0.0,
                   ext::make_shared<PlainVanillaPayoff>(Option::Put, 4420.20),
                   ext::make_shared<EuropeanExercise>(maturity));
//isda swap 10Y rate barrier option
BarrierOption ratesoption(Barrier::UpIn, .0155, 0.0,
                      ext::make_shared<PlainVanillaPayoff>(Option::Put, 0.0155),
                      ext::make_shared<EuropeanExercise>(maturity));

//Underlying Price
Handle<Quote> underlyingSPX(ext::shared_ptr<Quote>(new SimpleQuote(4429.1)));
Handle<Quote> underlyingISDA(ext::shared_ptr<Quote>(new SimpleQuote(0.01233)));

//Rho - correlation
Handle<Quote> rho(ext::shared_ptr<Quote>(new SimpleQuote(-0.15)));


//Risk-free Rate
Rate riskFreeRate = 0.01;
DayCounter dayCounter = Actual365Fixed();
Handle<YieldTermStructure> flatTermStructure(
  ext::shared_ptr<YieldTermStructure>(
      new FlatForward(settlementDate, riskFreeRate, dayCounter)));

//Sigma
Real volSPX = 0.16;
Handle<BlackVolTermStructure> flatVolSPX(
  ext::shared_ptr<BlackVolTermStructure>(new BlackConstantVol(
      settlementDate, calendar, volSPX, dayCounter)));

Real volISDA = 0.5;
Handle<BlackVolTermStructure> flatVolISDA(
  ext::shared_ptr<BlackVolTermStructure>(new BlackConstantVol(
      settlementDate, calendar, volISDA, dayCounter)));

//Dividend
Handle<YieldTermStructure> flatDividendTS(ext::shared_ptr<YieldTermStructure>(
  new FlatForward(settlementDate, 0.0, dayCounter)));

//black-scholes process
ext::shared_ptr<BlackScholesMertonProcess> bsmProcessSPX(
  new BlackScholesMertonProcess(underlyingSPX, flatDividendTS,
                                flatTermStructure, flatVolSPX));
ext::shared_ptr<BlackScholesMertonProcess> bsmProcessISDA(
  new BlackScholesMertonProcess(underlyingISDA, flatDividendTS,
                                flatTermStructure, flatVolISDA));

//pricing engine
ext::shared_ptr<PricingEngine> engine = ext::make_shared<AnalyticTwoAssetBarrierEngine> 
     (bsmProcessSPX,bsmProcessISDA,rho);

which_option_to_use_here.setPricingEngine(engine); //problem here

Any help is greatly appreciated. Thanks in advance.

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.