aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/globeop_reports.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/python/globeop_reports.py b/python/globeop_reports.py
index 862fccce..bf6159be 100644
--- a/python/globeop_reports.py
+++ b/python/globeop_reports.py
@@ -1,6 +1,9 @@
from db import dbengine
from pandas.tseries.offsets import DateOffset, MonthEnd
from yieldcurve import YC
+from quantlib.time.api import Date, Months, Period
+from quantlib.indexes.api import USDLibor
+from quantlib.termstructures.yield_term_structure import YieldTermStructure
import pandas as pd
import numpy as np
@@ -127,10 +130,12 @@ def get_rmbs_pos_df(date=None):
df = df[['endbookmv', 'endlocalmarketprice', 'identifier']]
calc_df = pd.DataFrame()
+ yc = YieldTermStructure()
+ libor1m = USDLibor(Period(1, Months), yc)
for d, g in df.groupby(pd.Grouper(freq='M')):
model_date = pd.to_datetime(timestamps[timestamps.timestamp <= d + DateOffset(days=1)].max()[0]).date()
- yc = YC(evaluation_date=model_date)
- libor = float(yc.zero_rate(.125))
+ yc.link_to(YC(evaluation_date=model_date))
+ libor = libor1m.fixing(libor1.fixing_calendar.adjust(Date.from_datetime(d)))
sql_string = ("SELECT date(timestamp) as timestamp, cusip, model_version, "
"pv, moddur, delta_yield, delta_ir "
"FROM priced where date(timestamp) = %s "