My goal is to price American basket put options using the Least squares Monte Carlo, or Longstaff-Schwartz algorithm.

I currently have the one-dimensional case working with the Python file below (I am using the SWIG package), but I would like to change the number of basis functions used by the AmericanBasketEngine to make sure the price is accurate. How do I do this?

Looking at the C++ source, I found the polynomOrder keyword argument with default value 2 of the class AmericanBasketPathPricer. However, I do not know how this class is connected to the MCAmericanBasketEngine, which does not have such a keyword argument. (I never programmed in either C or C++, so I am quite lost in the source.)

Maybe is the polynomial order determined automatically, based on the requiredTolerance? That would be ideal, but I couldn't find a description of what the MCAmericanBasketEngine does exactly anywhere.

from QuantLib import *

d=1 #To be increased...
todaysDate = Date(15,May,1998)
Settings.instance().evaluationDate = todaysDate
settlementDate = Date(17,May,1998)
riskFreeRate = FlatForward(settlementDate, 0.05, Actual365Fixed())

payoff = PlainVanillaPayoff(Option.Put, 100.0)

underlying1 = SimpleQuote(100.0)
volatility1 = BlackConstantVol(todaysDate, TARGET(), 0.30, Actual365Fixed())
dividendYield1 = FlatForward(settlementDate, 0.00, Actual365Fixed())
process1 = BlackScholesMertonProcess(QuoteHandle(underlying1),
procs = StochasticProcessVector()

matrix = Matrix(1,1)
matrix[0][0] = 1.0
process = StochasticProcessArray(procs, matrix)
american_exercise = AmericanExercise(Date(17,May,1998),Date(17,May,1999))
basketoption = BasketOption(AverageBasketPayoff(payoff,d),american_exercise)
        polynomOrder = 2,#keyword does not exist
        timeStepsPerYear = 100,
        requiredTolerance = 0.01,
        #seed = 42))

1 Answer 1


As per QuantLib's lead developer, polynomOrder is indeed not currently exposed. There is now a GitHub issue about this.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.