|
From: Jonathan S. <sw...@gm...> - 2022-04-27 12:08:25
|
Hi James, Looks like a typo - you want to pass in tenor instead of tenors to ql.SpreadCdsHelper. Jonathan On Tue, Apr 26, 2022 at 10:03 PM James Donaldson via QuantLib-users < qua...@li...> wrote: > Hello, > > > > I’m new to Quantlib and am trying to set up the market data required to > price CDX (IG) trades. When trying to generate CDS helper instruments for a > hazard curve, I’m receiving the error message “Wrong number or type of > arguments for overloaded function ‘new_SpreadCdsHelper’. Would you be able > to point out my error? I appreciate the help. > > > > Thanks, > > > > James > > > > # Market Data > > todaysDate = ql.Date(21, 4, 2022) > > > > calendar = ql.UnitedStates() > > > > recovery_rate = 0.4 > > > > quoted_spreads_bid = > [0.002492,0.002492,0.00358,0.005262,0.0063985,0.007535,0.008975,0.011255] > > > > tenors = [ql.Period(6, ql.Months), > > ql.Period(1, ql.Years), > > ql.Period(2, ql.Years), > > ql.Period(3, ql.Years), > > ql.Period(4, ql.Years), > > ql.Period(5, ql.Years), > > ql.Period(7, ql.Years), > > ql.Period(10, ql.Years)] > > > > # Generate a spot curve – discCrvObj is comprised of dates and discount > factors > > discCrvObj = ql.DiscountCurve(us_isda['maturity_date_ql'].to_list(), > > us_isda['discount_factor'].to_list(), > > ql.Actual360(), > > ql.UnitedStates()) > > > > discCrv = ql.YieldTermStructureHandle(discCrvObj) > > > > # Generate hazard curve > > cds_curve_instruments = [ > > ql.SpreadCdsHelper( > > ql.QuoteHandle(ql.SimpleQuote(s)), > > tenors, > > 0, > > calendar, > > ql.Quarterly, > > ql.Following, > > ql.DateGeneration.TwentiethIMM, > > ql.Actual365Fixed(), > > recovery_rate, > > discCrv > > ) > > for s, tenor in zip(quoted_spreads_bid, tenors) > > ] > > > > hazard_curve = ql.PiecewiseFlatHazardRate(todaysDate, > cds_curve_instruments, ql.Actual365Fixed()) > _______________________________________________ > QuantLib-users mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-users > |