|
From: <lis...@pm...> - 2022-08-08 22:44:47
|
Thank you David. This works on the schedule side, but from there it would fail when creating the CDS (probably because the ql.DateGeneration rule is not of CDS type). Indeed, after setting dates as you kindly suggested, creating a CDS object with that schedule ends up failing. quotedTrade = ql.CreditDefaultSwap( ql.Protection.Seller, 100, 0, spread, cdsSchedule, ql.Following,ql.Actual360(),True,True,tradeDate+1, ql.WeekendsOnly().advance(tradeDate,3*ql.Period(ql.Daily)), ql.FaceValueClaim(), ql.Actual360(True)) where the error is: RuntimeError: protection can not start after accrual So it seems one would first have to use a CDS rule for DateGeneration, and then find a way to replace for the non-standard last date. Thanks again. L ------- Original Message ------- On Monday, August 8th, 2022 at 5:53 PM, David Duarte <nh...@gm...> wrote: > Hi, > > You can use next to last: > > tradeDate = ql.Date(20, 6, 2022) > termDate = ql.Date(16, 11, 2022) > cdsSchedule = ql.Schedule(tradeDate, termDate, > 3*ql.Period(ql.Monthly), > ql.WeekendsOnly(), > ql.Following, ql.Unadjusted, > ql.DateGeneration.Backward, False, ql.Date(), ql.Date(20,9,2022)) > > (Date(20,6,2022), Date(20,9,2022), Date(16,11,2022)) > > On Mon, 8 Aug 2022 at 21:15, listsubs--- via QuantLib-users <qua...@li...> wrote: > >> Hi everyone - I'm trying to price a CDS with a non-standard maturity (11/16/2022), as of today. Tried many variants and looked online, but couldn't find a solution. >> >> When I create a schedule: >> >> cdsSchedule = ql.Schedule(tradeDate, termDate, >> 3*ql.Period(ql.Monthly), >> ql.WeekendsOnly(), >> ql.Following, ql.Unadjusted, ql.DateGeneration.CDS, False) >> >> The dates I get from the constructor are: >> >> cdsSchedule.dates() >> (Date(20,6,2022), Date(20,9,2022), Date(20,12,2022)) >> >> Is there a simple way to override the Date(20,12,2022) entry and replace it by Date(16,11,2022) ? >> >> Many thanks!L >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users |