January 2019
Intermediate to advanced
378 pages
8h 27m
English
Let's now take a look at the statistics for all three strategies. We'll create a function that can take in each series of returns, and will print out the summary results. We're going to get statistics for each of our winning, losing, and break-even trades, and something called the Sharpe ratio. I said earlier that returns are judged on a risk-adjusted basis; this is exactly what the Sharpe ratio provides us with; it is a method of comparing returns by accounting for the volatility of those returns. Here, we use the Sharpe ratio with an adjustment to annualize the ratio:
def get_stats(s, n=252): s = s.dropna() wins = len(s[s>0]) losses = len(s[s<0]) evens = len(s[s==0]) mean_w = round(s[s>0].mean(), 3) mean_l ...
Read now
Unlock full access