Hi all,
I’m trying to use Quantlib’s MCEuropeanBasketEngine
to price a simple basket option put so far have not been able to do so.
I’m using a C# SWIG compilation of Quantlib, and tried the following:
_exercise =
new
EuropeanExercise(_maturity);
var stochasticVector
= new
StochasticProcessVector((int)numAssets);
for (int
i = 0; i < numAssets; i++)
{
stochasticVector.Add(new
GeneralizedBlackScholesProcess(
new
QuoteHandle(_spotQuotes[i]),
new
YieldTermStructureHandle(_dividendCurves[i].TermStructure),
new
YieldTermStructureHandle(_riskFreeCurves[0].TermStructure),
new
BlackVolTermStructureHandle(_volMatrices[i].TermStructure)
));
}
var stochasticProcessArray
= new
StochasticProcessArray(stochasticVector,
_correlationMatrix);
//Since quantlib uses the exponential formula for the Monte Carlo, only one time step is needed for european options.
uint timeSteps = 1;
uint QL_NULL_INTEGER
= 0x7fffffff;
bool brownianBridge
= false;
//Increases precision by sampling -x whenever x is sampled.
bool antitheticVariate
= true;
int requiredSamples
= 10000;
double requiredTolerance
= 1e-3;
int maxSamples = 1000000;
//int seed;
_engine =
new
MCEuropeanBasketEngine(stochasticProcessArray,
"pseudorandom",
timeSteps, QL_NULL_INTEGER,
brownianBridge, antitheticVariate, requiredSamples, requiredTolerance, maxSamples);
_basketOption =
new
BasketOption(_payoff,
_exercise);
_basketOption.setPricingEngine(_engine);
This compiles fine, but using _basketOption.NPV()
for a basket of a single asset (when it should approximately match the Black & Scholes price) consistently overpriced the option (i.e., the average of a large number of runs was consistently above the B&S price). I suspected it either
had to do with the single time step (but since it’s an European option I thought this should work anyway) or with something I did not do regarding the random number generation.
What am I doing wrong?
Thanks,
Pedro Milet
Free forum by Nabble | Disable Popup Ads | Edit this page |