diff options
| -rw-r--r-- | python/collateral/common.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/python/collateral/common.py b/python/collateral/common.py index c03d3455..95e35eec 100644 --- a/python/collateral/common.py +++ b/python/collateral/common.py @@ -61,15 +61,13 @@ def get_bilateral_trades(d: datetime.date, fund: str, engine: Engine) -> pd.Data df_cds = pd.read_sql_query( "SELECT cpty_id, folder, initial_margin_percentage * abs(notional) / 100 as IA " "FROM list_cds2(%s::date, %s) " - "WHERE cp_code IS NOT NULL", # that way we get all tranches + the ABS_CDS + "WHERE orig_attach IS NOT NULL or cpty_id='6SIT0'", # that way we get all tranches + the ABS_CDS engine, params=(d, fund), ) df_swaptions = pd.read_sql_query( "SELECT cpty_id, folder, initial_margin_percentage * notional / 100 AS IA " - "FROM swaptions " - "WHERE cpty_id IS NOT NULL " - "AND trade_date <= %s AND fund=%s", + "FROM list_swaptions(%s::date, %s) ", engine, params=(d, fund), ) @@ -85,9 +83,9 @@ def get_bilateral_trades(d: datetime.date, fund: str, engine: Engine) -> pd.Data "SELECT cpty_id, folder, initial_margin_percentage * buy_amount / 100 AS IA " "FROM spots " "WHERE cpty_id IS NOT NULL " - "AND trade_date <= %s AND fund=%s", + "AND trade_date <= %s AND fund=%s AND settle_date >=%s", engine, - params=(d, fund), + params=(d, fund, d), ) df = pd.concat([df_cds, df_swaptions, df_caps, df_forwards]) df = df.replace({"folder": STRATEGY_CASH_MAPPING}) |
