aboutsummaryrefslogtreecommitdiffstats
path: root/python/collateral
diff options
context:
space:
mode:
Diffstat (limited to 'python/collateral')
-rw-r--r--python/collateral/__init__.py1
-rw-r--r--python/collateral/__main__.py3
-rw-r--r--python/collateral/citi.py4
-rw-r--r--python/collateral/common.py14
-rw-r--r--python/collateral/ms.py4
5 files changed, 17 insertions, 9 deletions
diff --git a/python/collateral/__init__.py b/python/collateral/__init__.py
index d33b2db4..fb8f2eac 100644
--- a/python/collateral/__init__.py
+++ b/python/collateral/__init__.py
@@ -6,5 +6,4 @@ try:
except KeyError:
sys.exit("Please set 'DAILY_DIR' and 'LOG_DIR' in the environment")
-from exchange import ExchangeMessage
from dates import bus_day
diff --git a/python/collateral/__main__.py b/python/collateral/__main__.py
index 3a326f27..a3392c2a 100644
--- a/python/collateral/__main__.py
+++ b/python/collateral/__main__.py
@@ -30,7 +30,7 @@ parser.add_argument(
"-s", "--send-email", action="store_true", help="send email to Globeop"
)
args = parser.parse_args()
-counterparties = ["citi", "ms", "gs", "baml_fcm", "wells"]
+counterparties = ["citi", "ms", "gs", "baml_fcm", "baml_isda", "wells"]
if args.download:
for cp in counterparties:
@@ -81,5 +81,6 @@ with conn.cursor() as c:
c.execute(sql_str, t)
conn.commit()
conn.close()
+
if args.send_email:
send_email(args.workdate, df)
diff --git a/python/collateral/citi.py b/python/collateral/citi.py
index f7d0818d..18a54a33 100644
--- a/python/collateral/citi.py
+++ b/python/collateral/citi.py
@@ -2,7 +2,7 @@ import pandas as pd
import subprocess
from bs4 import BeautifulSoup
from pandas.tseries.offsets import BDay
-from . import ExchangeMessage, DAILY_DIR, bus_day
+from . import DAILY_DIR, bus_day
def load_file(d):
@@ -18,6 +18,8 @@ def load_file(d):
def download_files(count=20):
+ from exchange import ExchangeMessage
+
em = ExchangeMessage()
emails = em.get_msgs(
path=["NYops", "Margin Calls Citi"], count=count, subject__startswith="262966"
diff --git a/python/collateral/common.py b/python/collateral/common.py
index de63f35e..6dac36bc 100644
--- a/python/collateral/common.py
+++ b/python/collateral/common.py
@@ -1,7 +1,6 @@
import logging
import pandas as pd
from exchangelib import HTMLBody
-from . import ExchangeMessage
logger = logging.getLogger(__name__)
@@ -25,20 +24,23 @@ def compare_notionals(df, positions, fcm: str):
def get_dawn_trades(d, engine):
df_cds = pd.read_sql_query(
- "SELECT cpty_id, folder FROM cds "
+ "SELECT cpty_id, folder, initial_margin_percentage * notional / 100 as IA "
+ "FROM cds "
"WHERE cpty_id IS NOT NULL AND trade_date <= %s",
engine,
params=(d,),
)
df_swaptions = pd.read_sql_query(
- "SELECT cpty_id, folder FROM swaptions "
+ "SELECT cpty_id, folder, initial_margin_percentage * notional / 100 AS IA "
+ "FROM swaptions "
"WHERE cpty_id IS NOT NULL "
"AND trade_date <= %s",
engine,
params=(d,),
)
df_caps = pd.read_sql_query(
- "SELECT cpty_id, folder FROM capfloors "
+ "SELECT cpty_id, folder, initial_margin_percentage * amount / 100 AS IA "
+ "FROM capfloors "
"WHERE cpty_id IS NOT NULL "
"AND trade_date <= %s",
engine,
@@ -68,6 +70,8 @@ def get_dawn_trades(d, engine):
def send_email(d, df):
+ from exchange import ExchangeMessage
+
pd.set_option("display.float_format", "{:.2f}".format)
df = df.drop("date", axis=1).set_index("broker")
cp_mapping = {
@@ -75,7 +79,7 @@ def send_email(d, df):
"MS": "Morgan Stanley",
"GS": "Goldman Sachs",
"BAML_FCM": "Baml FCM",
- # "BAML_ISDA": "Baml OTC",
+ "BAML_ISDA": "Baml OTC",
"WELLS": "Wells Fargo",
}
html = "<html><body>"
diff --git a/python/collateral/ms.py b/python/collateral/ms.py
index f71356d6..c8bdbc8a 100644
--- a/python/collateral/ms.py
+++ b/python/collateral/ms.py
@@ -1,8 +1,10 @@
import pandas as pd
-from . import ExchangeMessage, DAILY_DIR
+from . import DAILY_DIR
def download_files(count=20):
+ from exchange import ExchangeMessage
+
em = ExchangeMessage()
emails = em.get_msgs(
path=["NYops", "Margin calls MS"],