diff options
Diffstat (limited to 'python/analytics')
| -rw-r--r-- | python/analytics/index.py | 7 | ||||
| -rw-r--r-- | python/analytics/option.py | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/python/analytics/index.py b/python/analytics/index.py index 265e470d..0600deb9 100644 --- a/python/analytics/index.py +++ b/python/analytics/index.py @@ -18,10 +18,11 @@ from sqlalchemy import exc from pyisda.curve import SpreadCurve from .utils import previous_twentieth, build_table from bbg_helpers import BBG_IP, retrieve_data, init_bbg_session + from yieldcurve import YC, ql_to_jp, roll_yc, rate_helpers from weakref import WeakSet -engine = dbengine('serenitasdb') +_engine = dbengine('serenitasdb') def g(index, spread, exercise_date, forward_yc=None, pv=None): """computes the strike clean price using the expected forward yield curve. """ @@ -366,7 +367,7 @@ class Index(object): ref_data = retrieve_data(session, security, field) self.ref = ref_data[security][field] else: - run = engine.execute("""SELECT * FROM index_quotes + run = _engine.execute("""SELECT * FROM index_quotes WHERE index=%s AND series=%s AND tenor=%s AND date=%s""", (index_type, series, tenor, self.trade_date)) rec = run.fetchone() @@ -389,7 +390,7 @@ class Index(object): raise ValueError("Not enough information to load the index.") try: df = pd.read_sql_query(sql_str, - engine, parse_dates=['lastdate', 'issue_date'], + _engine, parse_dates=['lastdate', 'issue_date'], params=params) maturity = df.maturity[0] coupon = df.coupon[0] diff --git a/python/analytics/option.py b/python/analytics/option.py index e366c51b..5e764b68 100644 --- a/python/analytics/option.py +++ b/python/analytics/option.py @@ -10,7 +10,7 @@ from db import dbengine from .black import black, Nx from .sabr import sabr from .utils import GHquad, build_table -from .index import g, ForwardIndex, Index, engine +from .index import g, ForwardIndex, Index, _engine from yieldcurve import roll_yc from pandas.tseries.offsets import BDay @@ -464,7 +464,7 @@ class VolatilitySurface(ForwardIndex): "WHERE quotedate::date = %s AND index= %s AND series = %s " \ "AND quote_source != 'SG' " \ "ORDER BY quotedate DESC", - engine, + _engine, parse_dates = ['quotedate', 'expiry'], params=(trade_date, index_type.upper(), series)) self._quotes.loc[(self._quotes.quote_source == "GS") & (self._quotes['index'] =="HY"), |
