diff options
Diffstat (limited to 'python/analytics/tranche_functions.py')
| -rw-r--r-- | python/analytics/tranche_functions.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/python/analytics/tranche_functions.py b/python/analytics/tranche_functions.py index ab975a55..3355a887 100644 --- a/python/analytics/tranche_functions.py +++ b/python/analytics/tranche_functions.py @@ -30,9 +30,7 @@ def wrapped_ndpointer(*args, **kwargs): return type(base.__name__, (base,), {"from_param": classmethod(from_param)}) -libloss = np.ctypeslib.load_library( - "lossdistrib", Path(__file__).parent -) +libloss = np.ctypeslib.load_library("lossdistrib", Path(__file__).parent) libloss.fitprob.restype = None libloss.fitprob.argtypes = [ @@ -455,9 +453,9 @@ def credit_schedule(tradedate, coupon, yc, enddate=None, tenor=None, rule=CDS201 DC = Actual360() start_date = tradedate + 1 sched = Schedule.from_rule( - start_date, enddate, Period("3M"), cal, ModifiedFollowing, Unadjusted, rule + tradedate, enddate, Period("3M"), cal, ModifiedFollowing, Unadjusted, rule ) - payment_dates = [pydate_from_qldate(cal.adjust(d)) for d in sched[1:]] + payment_dates = [pydate_from_qldate(cal.adjust(d)) for d in sched if d > start_date] df = [yc.discount_factor(d) for d in payment_dates] coupons = [ DC.year_fraction(d1, d2) * coupon for d1, d2 in zip(sched[:-2], sched[1:-1]) @@ -490,9 +488,8 @@ def credit_schedule_pyisda( stub = "f/l" else: stub = "f/s" - print(stub) if rule is CDS2015: - start_date = previous_twentieth(start_date) + start_date = previous_twentieth(pydate_from_qldate(tradedate)) fl = FeeLeg(start_date, pydate_from_qldate(enddate), True, 1.0, coupon, stub=stub) df = pd.DataFrame({"coupons": [t[1] for t in fl.cashflows], **fl.inspect()}) df["df"] = [yc.discount_factor(d) for d in df.pay_dates] |
