1

I cannot use one of the useful functions in QuantLib when using python. Here is a simple example from QuantLib manual (one of Jupyter notebooks). I am reproducing a piece of code that reliably breaks on my Mac.

from QuantLib import *
today = Date(7, March, 2014)
Settings.instance().evaluationDate = today
option = EuropeanOption(PlainVanillaPayoff(Option.Call, 100.0),
                        EuropeanExercise(Date(7, June, 2014)))
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 = BlackScholesProcess(QuoteHandle(u),
                              YieldTermStructureHandle(riskFreeCurve),
                              BlackVolTermStructureHandle(volatility))
engine = AnalyticEuropeanEngine(process)
option.setPricingEngine(engine)
print option.NPV()
u.setValue(105.0) ### <= this step is broken

I installed QuantLib v.1.9.1 on my MacOs (10.11.6). Many functions work fine but once a pricing engine is setup and I want to reprice option with some changes in SimpleQuote, independent of model I get this popup: "The kernel appears to have died. It will restart automatically."

When the same script is used in Python REPL, I get "Segmentation fault: 11"

Anyone dealt with this situation? Any suggestions on how to resolve the issue? Or I am doing something incorrectly? Does anyone experience same problem on Windows? I can switch to Windows if it works there.

Many thanks!

mnos
  • 11
  • 2

1 Answers1

0

You seem to have a problem with your installation. The script is correct, and should work on Windows (and possibly on Mac OS too—you might also try to double-check the compilation flags suggested in the instructions). If you're familiar with Docker, another possibility is to download and run a precompiled IPython notebook server from the Docker Hub. It is the same Docker image that I use to run the notebooks you've been trying out.

Luigi Ballabio
  • 4,128
  • 21
  • 29
  • Thank you Luigi. I indeed spent quite some time doing the install on Mac. I thought I was "out of woods" when I was using Heston model from some published examples. It works just fine. It is when I needed to use SimpleQuote I got into problem. I am guessing that some of Boost is misbehaving for me (like shared_ptr). How do I find out that my Boost is installed correctly? Meanwhile, I will try the Docker. Thank you! – mnos Feb 24 '17 at 01:43
  • Hard to say. The parts of Boost that are used in the library are header-only, so they're no longer at play after compilation... – Luigi Ballabio Feb 24 '17 at 06:43