aboutsummaryrefslogtreecommitdiffstats
path: root/python/collateral/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/collateral/common.py')
-rw-r--r--python/collateral/common.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/python/collateral/common.py b/python/collateral/common.py
index d133bbec..ca8b6759 100644
--- a/python/collateral/common.py
+++ b/python/collateral/common.py
@@ -115,11 +115,18 @@ def get_bilateral_trades(d: datetime.date, fund: str, engine: Engine) -> pd.Data
params=(d, fund, d),
)
df_trs = pd.read_sql_query(
- "SELECT cpty_id, folder, initial_margin_percentage * notional/100 as IA from trs where cpty_id is NOT NULL and trade_date <= %s and fund=%s",
+ "SELECT cpty_id, folder, initial_margin_percentage * notional/100 AS ia FROM trs "
+ "WHERE cpty_id IS NOT NULL AND trade_date <= %s AND fund=%s",
engine,
params=(d, fund),
)
- df = pd.concat([df_cds, df_swaptions, df_caps, df_forwards, df_trs])
+ df_options = pd.read_sql_query(
+ "SELECT cpty_id, folder, initial_margin_percentage * quantity AS ia FROM equityoptions "
+ "WHERE cpty_id IS NOT NULL AND trade_date <= %s AND fund=%s",
+ engine,
+ params=(d, fund),
+ )
+ df = pd.concat([df_cds, df_swaptions, df_caps, df_forwards, df_trs, df_options])
df = df.replace({"folder": STRATEGY_CASH_MAPPING})
return df