diff options
Diffstat (limited to 'python/report_ops')
| -rw-r--r-- | python/report_ops/queries.py | 9 | ||||
| -rw-r--r-- | python/report_ops/sma.py | 8 |
2 files changed, 7 insertions, 10 deletions
diff --git a/python/report_ops/queries.py b/python/report_ops/queries.py index bc6c087a..c4955973 100644 --- a/python/report_ops/queries.py +++ b/python/report_ops/queries.py @@ -57,9 +57,8 @@ LEFT JOIN index_version_markit ivm ON security_id=redindexcode; """ IRS_QUERY = """ -SELECT isr.pv, irs.*, accounts2.name -FROM ir_swap_risk isr -LEFT JOIN irs ON id=swp_id -LEFT JOIN accounts2 USING (cash_account) -WHERE date=%s AND irs.fund=%s; +SELECT * FROM list_ir_positions(%s, %s) a +LEFT JOIN LATERAL (SELECT sum(pv) AS mtm_valuation +FROM ir_swap_risk WHERE swp_id = ANY(a.ids) AND date=a.date) +b ON true; """ diff --git a/python/report_ops/sma.py b/python/report_ops/sma.py index cc720071..2cd2d766 100644 --- a/python/report_ops/sma.py +++ b/python/report_ops/sma.py @@ -387,16 +387,14 @@ class IRSPosition(PositionReport, asset_class="irs"): rename_keys( d, { - "trade_date": "start_date", - "effectivedate": "effective_date", - "pv": "mtm_valuation", "maturity_date": "maturity", "float_index": "identifier", - "swap_type": "description", - "payreceive": "buysell", "cash_account": "account", "clearing_facility": "clearing_house", }, ) + d["dealid"] = "COMPRESSED" + d["buysell"] = "Pay" + d["cp_code"] = _fund_fcm[fund] d["primebroker"] = _fund_fcm[fund] return cls.from_dict(**d) |
