diff options
Diffstat (limited to 'python/exploration')
| -rw-r--r-- | python/exploration/tranche_var.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/python/exploration/tranche_var.py b/python/exploration/tranche_var.py new file mode 100644 index 00000000..67bdcaf2 --- /dev/null +++ b/python/exploration/tranche_var.py @@ -0,0 +1,23 @@ +import pandas as pd +from analytics import on_the_run +from analytics.utils import bus_day +from analytics.tranche_basket import Skew + +dr = pd.bdate_range("2019-01-01", "2019-11-19", freq=bus_day) +skew_dict = {} +prev_skew_dict = {} +for d in dr: + skew_dict = {} + for index in ("IG", "HY"): + otr = on_the_run(index, d) + for i in range(5): + skew_dict[(index, otr - 2 * i)] = Skew.from_desc( + index, otr - 2 * i, "5yr", value_date=d + ) + for k, v in skew_dict.items(): + try: + skew_shock[(d, index, 2 * i)] = v - prev_skew_dict[k] + except KeyError: + continue + prev_skew_dict = skew_dict + skew_dict = {} |
