I am right now working throught the "cookbook" of Goutham Balaraman & Luigi Ballabio. By the way a very nice introduction into QuantLib-Python and a good starting point :-)

In section four there is the following example that prices a simple option with Black&Scholes:

from QuantLib import *

today = Date(7, March, 2014)
Settings.instance().evaluationDate = today

# The Instrument
option = EuropeanOption( PlainVanillaPayoff(Option.Call, 100.0),
                         EuropeanExercise(Date(7, June, 2014)))

# The Market
u = SimpleQuote(100.0)      # set todays value of the underlying
r = SimpleQuote(0.01)       # set risk-free rate 
sigma = SimpleQuote(0.20)   # set volatility
riskFreeCurve = FlatForward(0, TARGET(), QuoteHandle(r), Actual360())
volatility = BlackConstantVol(0, TARGET(), QuoteHandle(sigma), Actual360())

# The Model
process = BlackScholesProcess( QuoteHandle(u), 

# The Pricing Engine
engine = AnalyticEuropeanEngine(process)

# The Result
print( "NPV: ", option.NPV() )

The code spits out the NPV of the option.

In university I once learned that the value of an option could be split up into an 'intrinsic' and 'time' part. Is it possible to achive this with QouantLib-Python?

 NPV_intrinsic = max([ 0 , u.value() - option.getStrike() ]) 

The above does not work because 'option.getStrike()' doesn't exist :-(

Thank you very much!

  • 1
    $\begingroup$ I don't think you need QuantLib to compute the intrinsic value of your option. It's simple to get max(S - K, 0), once you have this the time value is just the price minus the intrinsic value. $\endgroup$
    – byouness
    May 15, 2018 at 16:59
  • $\begingroup$ If you insist on using QuantLib for the intrinsic value, you can get it by using a duplicate of the option that you are pricing but with expiry = today. $\endgroup$
    – byouness
    May 15, 2018 at 16:59
  • $\begingroup$ You are right. The equation is simple. So I don't need QuntLib to compute it for me. But I need to reextract the strike from the option-object and have no idea how to achive it? $\endgroup$
    – Bernd
    May 15, 2018 at 18:29
  • $\begingroup$ In other words: what do I have to replace the option.getStrike() in the following command? NPV_intrinsic = max([ 0 , u.value() - option.getStrike() ]) $\endgroup$
    – Bernd
    May 15, 2018 at 18:30
  • $\begingroup$ Shouldn't it be possible to get the information about the methods of the option object somewhere here: quantlib.org/reference/class_quant_lib_1_1_european_option.html $\endgroup$
    – Bernd
    May 15, 2018 at 18:34

1 Answer 1


The method you're looking for is option.payoff(), which returns the payoff P of the option as a function object; the intrinsic value would then be P(u.value()).

However, the method is available in C++ but not yet exported to Python. I suggest you open an issue about this at https://github.com/lballabio/QuantLib-SWIG/issues so that the developers can pick it up.

  • $\begingroup$ The payoff-function evaluated at the price. That makes totally sense. Thanks! $\endgroup$
    – Bernd
    May 16, 2018 at 17:40
  • 1
    $\begingroup$ Issue was added at GitHub, here: github.com/lballabio/QuantLib-SWIG/issues/113 $\endgroup$
    – Bernd
    May 16, 2018 at 17:41

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.