aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/position.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/python/position.py b/python/position.py
index 02499164..9e00d259 100644
--- a/python/position.py
+++ b/python/position.py
@@ -227,21 +227,26 @@ def update_swaption_vol(
----------
vol_type : one of 'N', 'V' or 'N_OIS' (normal or log-normal)
"""
+ _alt_exp = {10: "J", 12: "L", 15: "O", 20: "T", 25: "Y", 30: "Z"}
match vol_type:
case "N":
db_vol_type = "Normal"
ticker_pattern = "USSN{:0>2}{} {} Curncy"
+ alt_exp = lambda e, t: e
case "V":
db_vol_type = "LogNormal"
ticker_pattern = "USSV{:0>2}{} {} Curncy"
+ alt_exp = lambda e, t: e
case "N_OIS":
db_vol_type = "Normal (OIS)"
ticker_pattern = "USSNA{}{} {} Curncy"
+ sources = ("ICPL", "BGN")
+ alt_exp = lambda e, t: _alt_exp.get(e, e) if t >= 10 else e
mappings = {"A": "1M", "C": "3M", "F": "6M", "I": "9M"}
for source in sources:
tickers = {
- ticker_pattern.format(e, t, source): (e, t)
+ ticker_pattern.format(alt_exp(e, t), t, source): (e, t)
for e, t in product(expiries, tenors)
}
data = retrieve_data(session, tickers, ["PX_LAST"], start_date=start_from)