diff options
Diffstat (limited to 'python/exploration/curve_trades.py')
| -rw-r--r-- | python/exploration/curve_trades.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/python/exploration/curve_trades.py b/python/exploration/curve_trades.py index f4144551..4e99fc94 100644 --- a/python/exploration/curve_trades.py +++ b/python/exploration/curve_trades.py @@ -17,12 +17,28 @@ spreads_diff.plot() df = index_returns(index='IG', series=[24, 25, 26, 27, 28], tenor=['3yr', '5yr', '7yr', '10yr']) ## on-the-run returns returns = df.price_return.unstack(-1).dropna().groupby(level='date').nth(-1) +<<<<<<< Updated upstream strategy510 = returns['5yr'] - 0.56 * returns['10yr'] strategy710 = returns['7yr'] - 0.75 * returns['10yr'] strategy3510 = -2*returns['3yr']+3*returns['5yr'] - returns['10yr'] +======= +strategy510 = 1.78 * returns['5yr'] - returns['10yr'] +strategy710 = 1.33 * returns['7yr'] - returns['10yr'] +strategy3510 = -2 * returns['3yr']+ 3 * returns['5yr'] - 1 * returns['10yr'] + +>>>>>>> Stashed changes 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) +monthly_returns3510 = strategy3510.groupby(pd.TimeGrouper(freq='M')).agg(lambda df:(1+df).prod()-1) sharpe510 = strategy510.mean()/strategy510.std()*math.sqrt(252) sharpe710 = strategy710.mean()/strategy710.std()*math.sqrt(252) sharpe3510 = strategy3510.mean()/strategy3510.std()*math.sqrt(252) + +monthly_sharpe510 = monthly_returns510.mean()/monthly_returns510.std()*math.sqrt(12) +monthly_sharpe710 = monthly_returns710.mean()/monthly_returns710.std()*math.sqrt(12) +monthly_sharpe3510 = monthly_returns3510.mean()/monthly_returns3510.std()*math.sqrt(12) + +worst_drawdown510 = strategy510.nsmallest(10) +worst_drawdown710 = strategy710.nsmallest(10) +worst_drawdown3510 = strategy3510.nsmallest(10) |
