Notebook

Quality Companies in an Uptrend(modified by Vladimir) Anthony FJ Garner setup

In [10]:
import pyfolio as pf
import matplotlib.pyplot as plt
import empyrical  as ep
In [11]:
bt = get_backtest('5de9377aa660b24c2eb8246d')
returns = bt.daily_performance['returns']
100% Time:  0:00:06|##########################################################|
In [12]:
cum_returns = ep.cum_returns(returns)
ax = cum_returns.plot(figsize=(14,5))
ax.set(title='Cumulative Returns', ylabel='returns', xlabel='date');
In [13]:
benchmark_rets = pf.utils.get_symbol_rets('SPY')
pf.plotting.show_perf_stats(returns, benchmark_rets)
Start date2003-01-02
End date2019-11-18
Total months202
Backtest
Annual return 31.8%
Cumulative returns 10395.3%
Annual volatility 25.4%
Sharpe ratio 1.22
Calmar ratio 0.93
Stability 0.95
Max drawdown -34.3%
Omega ratio 1.24
Sortino ratio 1.77
Skew -0.23
Kurtosis 3.46
Tail ratio 1.06
Daily value at risk -3.1%
Alpha 0.25
Beta 0.57
In [14]:
fig = plt.figure(1)
plt.subplot(1,3,1)
pf.plot_annual_returns(returns)
plt.subplot(1,3,2)
pf.plot_monthly_returns_dist(returns)
plt.subplot(1,3,3)
pf.plot_monthly_returns_heatmap(returns)
plt.tight_layout()
fig.set_size_inches(15,5)
In [15]:
ax = bt.recorded_vars.plot(figsize=(14,5))
ax.set(title='Positions Count', xlabel='date');
In [ ]: