Notebook

From: https://www.quantopian.com/algorithms/5b71fa2d9de4f300406e0f85/5b7857244c3482441b95e7e2/old

Trend Follow Algo. Returned to initial capital of $10,000,000. No change to code, but very slightly changed numbers that could have an impact on the strategy's payoff matrix. Changed scheduled trade execution time of day. Trading interval: 10.25 years.

In [1]:
bt = get_backtest('5b7857244c3482441b95e7e2')
100% Time: 0:00:25|###########################################################|
In [2]:
bt.create_full_tear_sheet(round_trips=True, hide_positions=True, live_start_date = "2016-01-01")
Start date2007-08-02
End date2017-12-29
In-sample months100
Out-of-sample months23
All In-sample Out-of-sample
Annual return 36.5% 33.2% 51.3%
Cumulative returns 2455.0% 1017.8% 128.6%
Annual volatility 35.0% 35.7% 31.8%
Sharpe ratio 1.07 0.98 1.46
Calmar ratio 0.85 0.77 1.51
Stability 0.93 0.89 0.60
Max drawdown -43.1% -43.1% -33.9%
Omega ratio 1.20 1.18 1.28
Sortino ratio 1.53 1.40 2.16
Skew -0.28 -0.29 -0.21
Kurtosis 2.30 2.26 2.24
Tail ratio 0.98 0.95 1.17
Daily value at risk -4.3% -4.4% -3.8%
Gross leverage 3.27 2.88 4.92
Daily turnover 4.2% 4.5% 3.3%
Alpha 0.35 0.34 0.30
Beta 0.19 0.14 1.06
Worst drawdown periods Net drawdown in % Peak date Valley date Recovery date Duration
0 43.10 2013-05-08 2013-06-24 2014-07-16 311
1 38.29 2011-04-29 2012-05-18 2013-04-12 511
2 33.95 2016-03-03 2016-11-11 2017-03-01 260
3 26.10 2008-07-02 2008-08-28 2008-10-09 72
4 25.49 2009-03-09 2009-06-15 2009-09-10 134
/usr/local/lib/python2.7/dist-packages/numpy/lib/function_base.py:3834: RuntimeWarning: Invalid value encountered in percentile
  RuntimeWarning)
Stress Events mean min max
Lehmann 0.09% -5.94% 9.20%
US downgrade/European Debt Crisis 0.52% -13.00% 10.87%
Fukushima 0.64% -3.65% 5.10%
EZB IR Event 0.08% -3.37% 5.46%
Aug07 0.06% -2.45% 2.20%
Mar08 -0.60% -5.54% 2.03%
Sept08 0.44% -5.94% 9.20%
2009Q1 0.45% -3.95% 4.85%
2009Q2 -0.25% -4.35% 5.04%
Flash Crash -1.09% -7.55% 6.53%
Apr14 0.03% -7.35% 4.57%
Oct14 0.87% -4.55% 7.50%
Fall2015 0.03% -4.36% 2.36%
Low Volatility Bull Market 0.00% 0.00% 0.00%
GFC Crash 0.22% -6.11% 9.20%
Recovery 0.11% -13.00% 10.87%
New Normal 0.15% -9.81% 9.70%
/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_base.py:2787: UserWarning: Attempting to set identical left==right results
in singular transformations; automatically expanding.
left=732889.0, right=732889.0
  'left=%s, right=%s') % (left, right))