aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/position_file_bowdst.py90
1 files changed, 90 insertions, 0 deletions
diff --git a/python/position_file_bowdst.py b/python/position_file_bowdst.py
index c89714d7..279c9584 100644
--- a/python/position_file_bowdst.py
+++ b/python/position_file_bowdst.py
@@ -45,6 +45,24 @@ HEADERS = {
"Local Market Value",
"Fx Rate",
],
+ "future": [
+ "AccountNumber",
+ "COB Date",
+ "Prime Broker",
+ "SecurityType",
+ "BBGTicker",
+ "RIC",
+ "UnderlyingSecurity",
+ "SecurityDescription",
+ "Currency",
+ "Quantity",
+ "OpenTradeEquity",
+ "ClosingPrice",
+ "MaturityDate",
+ "Unrealised P&L in USD",
+ "Local Market Value",
+ "Fx Rate",
+ ],
"otc": [
"Client Name",
"Fund Name",
@@ -177,3 +195,75 @@ with dawndb.cursor() as c:
)
trades.append(obj)
process_upload(trades, "otc")
+
+ c.execute(
+ "SELECT abs(spr.notional) AS active_notional, spr.nav, swaptions.*, index_version_markit.effectivedate FROM list_ir_swaption_positions(%s, 'BOWDST') spr LEFT JOIN swaptions ON deal_id=dealid LEFT JOIN index_version_markit ON swaptions.security_id=redindexcode;",
+ (date,),
+ )
+ trades = []
+ for row in c:
+ obj = row._asdict()
+ obj["Client Name"] = "HEDGEMARK"
+ obj["Fund Name"] = "BOS_PAT_BOWDOIN"
+ obj["Product Type"] = "CD Swaption"
+ obj["TransactionIndicator (Buy/Sell)"] = "B" if obj["buysell"] else "S"
+ obj["PutCall Indicator (Call/Put)"] = (
+ "P" if obj["option_type"] == "PAYER" else "C"
+ )
+ obj["Exercise Type"] = "European"
+ obj["MTM Currency"] = "USD"
+ obj["COB Date"] = date
+ obj["Clearing House Name"] = "Bilateral"
+ rename_keys(
+ obj,
+ {
+ "dealid": "Unique Deal ID",
+ "cp_code": "Counterparty",
+ "currency": "DealCurrencyA",
+ "active_notional": "NotionalA",
+ "fixed_rate": "FixedRate",
+ "strike": "Strike",
+ "effectivedate": "Effective Date",
+ "trade_date": "Start Date",
+ "maturity": "Maturity Date",
+ "expiration_date": "Underlying Maturity",
+ "security_id": "Underlying (ISIN / CUSP / RED CODES)",
+ "security_desc": "Underlying Desc",
+ "nav": "MTM Valuation",
+ },
+ )
+ trades.append(obj)
+ process_upload(trades, "otc")
+
+ c.execute(
+ "SELECT cds.*, ivm.effectivedate FROM list_cds_marks(%s, null, 'BOWDST') cds LEFT JOIN index_version_markit ivm ON security_id=redindexcode;",
+ (date,),
+ )
+ trades = []
+ for row in c:
+ obj = row._asdict()
+ obj["Client Name"] = "HEDGEMARK"
+ obj["Fund Name"] = "BOS_PAT_BOWDOIN"
+ obj["Counterparty"] = "GS"
+ obj["Product Type"] = "Credit Index"
+ obj["Unique Deal ID"] = obj["security_id"]
+ obj["TransactionIndicator (Buy/Sell)"] = "B" if obj["notional"] > 0 else "S"
+ obj["DealCurrencyA"] = "EUR" if obj["index"] in ("EU", "XO") else "USD"
+ obj["NotionalA"] = abs(obj["notional"])
+ obj["Start Date"] = date
+ obj["MTM Currency"] = "USD"
+ obj["MTM Valuation"] = obj["clean_nav"] + obj["accrued"]
+ obj["COB Date"] = date
+ obj["Clearing House Name"] = "ICE"
+ rename_keys(
+ obj,
+ {
+ "coupon": "FixedRate",
+ "effectivedate": "Effective Date",
+ "maturity": "Maturity Date",
+ "security_id": "Underlying (ISIN / CUSP / RED CODES)",
+ "security_desc": "Underlying Desc",
+ },
+ )
+ trades.append(obj)
+ process_upload(trades, "otc")