Login  Register

How to price the arithmetic option using python quantlib

Posted by floatwing on Apr 11, 2017; 1:39am
URL: http://quantlib.414.s1.nabble.com/How-to-price-the-arithmetic-option-using-python-quantlib-tp18180.html

I tried many times, but it went wrong and i don't know how to fix it.
I used the DiscreteAveragingAsianOption method to price the arithmetic option where i used the MCDiscreteArithmeticAPEngine to generize the Monte Carlo path of Underlying prices. But I cann't correctly quote the two functions. If there are any python docs or examples to price the arithmetc option?
I searched the internet for a long time with little materials.Some of my codes are as follows:

process2 = GeneralizedBlackScholesProcess(QuoteHandle(underlying),
                                         YieldTermStructureHandle(dividendYield),
                                         YieldTermStructureHandle(riskFreeRate),
                                         BlackVolTermStructureHandle(volatility))

#asian settings
averageType = Average().Arithmetic
runningAccumulator = 1
pastFixings = 0
fixingDates = []
isBrownianbridge = False
isAntitheticvariate = True
isControlvariate = False
requiredSamples = 10000
requiredTolerance = 1e-3
maxSamples = 100000
seed = 42
enginestr = 'pr'
option = DiscreteAveragingAsianOption(averageType, runningAccumulator, pastFixings, fixingDates, payoff, excercise)
engine = MCDiscreteArithmeticAPEngine(process2, enginestr, isBrownianbridge, isAntitheticvariate, isControlvariate, requiredSamples, requiredTolerance, maxSamples, seed)

Plz tell what's wrong or how to quote the two functions!!