diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/risk/tranches.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/python/risk/tranches.py b/python/risk/tranches.py index 22291170..f4391f99 100644 --- a/python/risk/tranches.py +++ b/python/risk/tranches.py @@ -11,8 +11,9 @@ def get_tranche_portfolio(date, conn, by_strat=False, fund="SERCGMAST"): sql_string = ("SELECT folder, id from cds " "WHERE orig_attach IS NOT NULL " "AND (termination_date IS NULL OR termination_date > %s) " - "AND maturity > %s AND fund = %s ORDER BY trade_date") - params = (date, date, fund) + "AND maturity > %s AND trade_date <= %s " + "AND fund = %s ORDER BY trade_date") + params = (date, date, date, fund) with conn.cursor() as c: c.execute(sql_string, params) trade_ids = [tuple(e) for e in c] @@ -49,10 +50,13 @@ def insert_tranche_portfolio(portf, conn): trade_id, trade.clean_pv, -trade._accrued * trade.notional, - trade.theta(method="TLP"), trade.duration, trade.delta, + trade.gamma, + trade.theta(method="TLP"), trade.upfront, + trade.rho[0], + trade.rho[1], trade.tranche_running, 100 - float(trade._index.pv()) * 100, trade._index._snacspread(trade._index.coupon(), |
