Login  Register

Trouble with HestonProcess Evolve for custom MC in Python/SWIG

Posted by kmclaugh on Feb 24, 2017; 9:59pm
URL: http://quantlib.414.s1.nabble.com/Trouble-with-HestonProcess-Evolve-for-custom-MC-in-Python-SWIG-tp18110.html

Hi all. I'm having some trouble using the evolve() method for a HestonProcess, it causes an Access violation and crashes. Here is an example. I'm not sure if I'm doing something wrong, or if perhaps something is wrong with my installation. I'm using QuantLib-1.9, QuantLib-SWIG-1.9, swigwin-3.0.12, and boost_1_63_0-msvc-10.0-32.

  today = Date(30, 12, 2016)
  Settings.instance().evaluationDate = today
  option = EuropeanOption(PlainVanillaPayoff(Option.Call, 100.0), EuropeanExercise(Date(30,1,2017)))
 
  u = SimpleQuote(100.0)
  r = SimpleQuote(0.01)
  sigma = SimpleQuote(0.20)
 
  riskFreeCurve=FlatForward(0, TARGET(), QuoteHandle(r), Actual360())
  volatility = BlackConstantVol(0, TARGET(), QuoteHandle(sigma), Actual360())
 
  process = HestonProcess(YieldTermStructureHandle(riskFreeCurve),
                                    YieldTermStructureHandle(FlatForward(0, TARGET(), 0.0, Actual360())),
                                    QuoteHandle(u),
                                    0.04, 0.1, 0.01, 0.05, 0.75)

It prices fine if I add the following lines
model = HestonModel(process)
engine = AnalyticHestonEngine(model)
option.setPricingEngine(engine)
print option.NPV()

but if I call the following
process.evolve(0,25,0.01,0.5)


I already have working code to price an exotic product that works perfectly if I use
BlackProcess()
, so I could just replace the process with Heston, that would be ideal.

I tried looking into
MultiPathGenerator
 also, but the constructor doesn't appear to be exposed through SWIG. Again, perhaps it's a problem with my install.