diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/dates.py | 2 | ||||
| -rw-r--r-- | python/pnl_explain.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/python/dates.py b/python/dates.py index fbdc7d98..025949b6 100644 --- a/python/dates.py +++ b/python/dates.py @@ -11,7 +11,7 @@ bond_cal = HolidayCalendarFactory('BondCalendar', fed_cal, GoodFriday) bus_day = CustomBusinessDay(calendar=bond_cal()) def imm_dates(start_date, end_date): - start_date = bus_day.rollback(start_date)-19*Day() + start_date = bus_day.rollback(start_date) - 19 * Day() start_date = QuarterBegin(startingMonth=3).rollback(start_date) #should be close=left I think return (pd.date_range(start_date, end_date, freq='QS-MAR', closed=None). diff --git a/python/pnl_explain.py b/python/pnl_explain.py index 0be46854..25af238e 100644 --- a/python/pnl_explain.py +++ b/python/pnl_explain.py @@ -4,7 +4,7 @@ import pandas as pd from db import dbengine from dates import bus_day, imm_dates, yearfrac -def get_daycount(identifier, engine = dbengine("dawndb")): +def get_daycount(identifier, engine=dbengine("dawndb")): """ retrieve daycount and paydelay for a given identifier""" conn = engine.raw_connection() with conn.cursor() as c: @@ -19,7 +19,7 @@ def get_daycount(identifier, engine = dbengine("dawndb")): return a, b def pnl_explain(identifier, start_date = None, end_date = None, - engine = dbengine("dawndb")): + engine=dbengine("dawndb")): """ if start_date is None, pnl since inception""" trades = pd.read_sql_query("SELECT * FROM bonds where identifier=%s", engine, params=(identifier,), parse_dates=['trade_date', 'settle_date']) |
