I am newbie in Python and I am trying to price a CDS Option in quantlib Python. I have the below code:
expiry= ql.Date(15,ql.May,2012)
cds_vol=0.5
exercise = ql.EuropeanExercise(expiry)
cds_option=ql.CdsOption(cds, exercise, True)
risk_free_rate = ql.YieldTermStructureHandle(ql.FlatForward(todaysDate, 0.01, ql.Actual365Fixed()))
probability = ql.DefaultProbabilityTermStructureHandle(hazard_curve)
cds = ql.CreditDefaultSwap(ql.Protection.Seller, nominal, s, schedule, ql.Following, ql.Actual365Fixed())
engine = ql.MidPointCdsEngine(probability, recovery_rate, risk_free_rate)
cds.setPricingEngine(engine)
cds_option_price=cds_option.setPricingEngine((ql.BlackCdsOptionEngine(probability, recovery_rate, risk_free_rate,cds_vol)))
cds_option_price.NPV()
This gives me an error:TypeError: in method 'new_BlackCdsOptionEngine', argument 4 of type 'Handle< Quote > const &'