aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/yieldcurve.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/yieldcurve.py b/python/yieldcurve.py
index 94f7ceb1..9dfbd79b 100644
--- a/python/yieldcurve.py
+++ b/python/yieldcurve.py
@@ -132,10 +132,10 @@ def get_dates(date, currency="USD"):
year_periods = [2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 15, 20, 25, 30]
calendar = WeekendsOnly()
settle_date = calendar.advance(Date.from_datetime(date), 2, 0)
- deposit_dates = [calendar.advance(settle_date, period = Period(m, Months),
+ deposit_dates = [calendar.advance(settle_date, period=Period(m, Months),
convention=ModifiedFollowing) \
for m in month_periods]
- swap_dates = [calendar.advance(settle_date, period = Period(y, Years),
+ swap_dates = [calendar.advance(settle_date, period=Period(y, Years),
convention=ModifiedFollowing) \
for y in year_periods]
dates = deposit_dates + swap_dates
@@ -143,7 +143,7 @@ def get_dates(date, currency="USD"):
def roll_yc(yc, forward_date):
"""returns the expected forward yield cuve on a forward_date"""
- dates = get_dates(forward_date)
+ dates = [d for d in yc.dates if d >= forward_date]
dfs = np.array([yc.discount_factor(d, forward_date) for d in dates])
return YieldCurve.from_discount_factors(forward_date, dates, dfs, 'ACT/365F')