diff options
| -rw-r--r-- | python/exploration/curve_trades.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/python/exploration/curve_trades.py b/python/exploration/curve_trades.py index 6a8c6cce..f4144551 100644 --- a/python/exploration/curve_trades.py +++ b/python/exploration/curve_trades.py @@ -1,5 +1,6 @@ from index_data import get_index_quotes, index_returns import pandas as pd +import math ## look at spreads df = get_index_quotes("IG", [23, 24, 25, 26, 27], tenor=['3yr', '5yr', '7yr', '10yr']) @@ -17,7 +18,7 @@ df = index_returns(index='IG', series=[24, 25, 26, 27, 28], tenor=['3yr', '5yr', ## on-the-run returns returns = df.price_return.unstack(-1).dropna().groupby(level='date').nth(-1) strategy510 = returns['5yr'] - 0.56 * returns['10yr'] -strategy710 = returns['5yr'] - 0.75 * returns['10yr'] +strategy710 = returns['7yr'] - 0.75 * returns['10yr'] strategy3510 = -2*returns['3yr']+3*returns['5yr'] - returns['10yr'] monthly_returns510 = strategy510.groupby(pd.TimeGrouper(freq='M')).agg(lambda df:(1+df).prod()-1) monthly_returns710 = strategy710.groupby(pd.TimeGrouper(freq='M')).agg(lambda df:(1+df).prod()-1) |
