diff options
| -rw-r--r-- | python/position_file_isosel.py | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/python/position_file_isosel.py b/python/position_file_isosel.py index 8d592804..22c8fc4e 100644 --- a/python/position_file_isosel.py +++ b/python/position_file_isosel.py @@ -123,37 +123,37 @@ def positions_otc(conn, date): # obj["COB Date"] = date # obj["Product Type"] = "Futures" # yield obj - # c.execute( - # "SELECT trb.trade_id, trb.serenitas_clean_nav + trb.serenitas_accrued as mtm, trb.notional * trb.tranche_factor as active_notional, cds.* FROM tranche_risk_bowdst trb left join cds on trade_id=id WHERE date=%s", - # (date,), - # ) - # for row in c: - # obj = row._asdict() - # obj["Client Name"] = "HEDGEMARK" - # obj["Fund Name"] = "BOS_PAT_BOWDOIN" - # obj["Product Type"] = "Credit Index Tranche" - # obj["TransactionIndicator (Buy/Sell)"] = ( - # "B" if obj["protection"] == "Buyer" else "S" - # ) - # obj["MTM Currency"] = "USD" - # obj["COB Date"] = date - # rename_keys( - # obj, - # { - # "dealid": "Unique Deal ID", - # "cp_code": "Counterparty", - # "currency": "DealCurrencyA", - # "active_notional": "NotionalA", - # "fixed_rate": "FixedRate", - # "trade_date": "Start Date", - # "effective_date": "EffectiveDate", - # "maturity": "Maturity Date", - # "security_id": "Underlying (ISIN / CUSP / RED CODES)", - # "security_desc": "Underlying Desc", - # "mtm": "MTM Valuation", - # }, - # ) - # yield obj + c.execute( + "SELECT trb.trade_id, trb.serenitas_clean_nav + trb.serenitas_accrued as mtm, trb.notional * trb.tranche_factor as active_notional, cds.* FROM tranche_risk_selene trb left join cds on trade_id=id WHERE date=%s", + (date,), + ) + for row in c: + obj = row._asdict() + obj["Client Name"] = "HEDGEMARK" + obj["Fund Name"] = "BOS_PAT_BOWDOIN" + obj["Product Type"] = "Credit Index Tranche" + obj["TransactionIndicator (Buy/Sell)"] = ( + "B" if obj["protection"] == "Buyer" else "S" + ) + obj["MTM Currency"] = "USD" + obj["COB Date"] = date + rename_keys( + obj, + { + "dealid": "Unique Deal ID", + "cp_code": "Counterparty", + "currency": "DealCurrencyA", + "active_notional": "NotionalA", + "fixed_rate": "FixedRate", + "trade_date": "Start Date", + "effective_date": "EffectiveDate", + "maturity": "Maturity Date", + "security_id": "Underlying (ISIN / CUSP / RED CODES)", + "security_desc": "Underlying Desc", + "mtm": "MTM Valuation", + }, + ) + yield obj # c.execute( # "SELECT abs(spr.notional) AS active_notional, spr.serenitas_nav, swaptions.*, index_version_markit.annexdate FROM list_swaption_positions_and_risks(%s, 'ISOSEL') spr LEFT JOIN swaptions ON deal_id=dealid LEFT JOIN index_version_markit ON swaptions.security_id=redindexcode;", # (date,), |
