aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/analytics/tranche_functions.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/python/analytics/tranche_functions.py b/python/analytics/tranche_functions.py
index b72d4bba..9c00c9eb 100644
--- a/python/analytics/tranche_functions.py
+++ b/python/analytics/tranche_functions.py
@@ -452,8 +452,16 @@ def credit_schedule(tradedate, coupon, yc, enddate=None, tenor=None, rule=CDS201
cal = WeekendsOnly()
DC = Actual360()
start_date = tradedate + 1
+ # if start_date falls on a week-end and is an imm date, our schedule is too short
+ # so use trade_date instead
sched = Schedule.from_rule(
- tradedate, enddate, Period("3M"), cal, ModifiedFollowing, Unadjusted, rule
+ tradedate if rule == CDS2015 else start_date,
+ enddate,
+ Period("3M"),
+ cal,
+ ModifiedFollowing,
+ Unadjusted,
+ rule,
)
if sched[1] == start_date: # we need to skip one date
sched = sched.after(start_date)