Setting Up a Correlated Two-Asset Barrier Option in QuantLib
Summary
The document presents a pricing setup for a barrier option whose payoff depends on two underlyings: an equity index and an interest-rate measure. It describes separate barrier conditions for the two assets, with both conditions required, and shows an attempted QuantLib configuration using individual barrier options, two Black–Scholes–Merton processes, a correlation input, and an analytic two-asset barrier pricing engine.
The practical issue is that the experimental two-asset option class appears to accept only one barrier, leaving the author unsure which option class can express the desired joint conditions. The document contains no accepted solution, pricing output, or validation that the shown setup matches the intended payoff. It is therefore useful mainly as an illustration of the modeling and API challenge: a joint barrier payoff may require an instrument class or payoff definition capable of representing both barrier events, rather than simply attaching an engine to one of the single-asset options.
Key ideas
- The target payoff requires barrier conditions on two distinct underlyings to be met jointly.
- The attempted setup models each underlying with its own process and uses correlation as an input to the pricing engine.
- A single-barrier option instrument may not represent a payoff governed by two separate barriers.
- The document leaves the required QuantLib instrument class unresolved and gives no pricing results.
Tags
Full text
# QuantLib Two Asset Barrier Option
# QuantLib Two Asset Barrier Option
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.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.