You will need a little customization. For convenience, and if you do not come across names, you are better off importing everything:
from QuantLib import *
then create an option that requires exercise and gain:
exercise = EuropeanExercise(Date(3,August,2011)) payoff = PlainVanillaPayoff(Option.Call, 100.0) option = EuropeanOption(payoff,exercise)
(Note that you will need a due date, not a time to maturity.)
Now, whether you want to evaluate it or get implied volatility, you have to set up the Black-Scholes process. There are several mechanisms involved, because you canโt just pass the cost of, say, a risk-free rate: you need a full curve, so you create a flat one and wrap it in a pen. The same goes for dividend yield and volume; the base value is given in the quote. (I am not explaining that all objects are: commentary if you need it.)
S = QuoteHandle(SimpleQuote(100.0)) r = YieldTermStructureHandle(FlatForward(0, TARGET(), 0.03, Actual360())) q = YieldTermStructureHandle(FlatForward(0, TARGET(), 0.01, Actual360())) sigma = BlackVolTermStructureHandle(BlackConstantVol(0, TARGET(), 0.20, Actual360())) process = BlackScholesMertonProcess(S,q,r,sigma)
(Volatility will not actually be used to calculate the implied volume, but you still need it.)
Now, for implied volatility, you will call:
option.impliedVolatility(11.10, process)
and to evaluate:
engine = AnalyticEuropeanEngine(process) option.setPricingEngine(engine) option.NPV()
You can use other functions (transfer speed in quote so you can change them later, etc.), but this should help you get started.