In [5]:
%matplotlib inline
# silence warnings
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
import pyfolio as pf
results = pd.read_pickle('output.pickle')
returns, positions, transactions = pf.utils.extract_rets_pos_txn_from_zipline(results)
pf.create_full_tear_sheet(returns, positions=positions, transactions=transactions,
live_start_date=None, round_trips=True)
Start date 2015-01-05
End date 2017-12-14
Total months 29
Backtest
Annual return
3.5%
Cumulative returns
8.9%
Annual volatility
33.5%
Sharpe ratio
0.27
Calmar ratio
0.08
Stability
0.00
Max drawdown
-42.7%
Omega ratio
1.07
Sortino ratio
0.38
Skew
-0.26
Kurtosis
5.98
Tail ratio
1.07
Daily value at risk
-4.2%
Gross leverage
1.00
Daily turnover
3.0%
Worst drawdown periods
Net drawdown in %
Peak date
Valley date
Recovery date
Duration
0
42.73
2015-06-15
2016-03-29
NaT
NaN
1
22.33
2015-01-05
2015-03-11
2015-04-20
76
2
19.14
2015-05-04
2015-05-07
2015-06-08
26
3
6.20
2015-04-28
2015-04-30
2015-05-04
5
4
4.42
2015-04-23
2015-04-24
2015-04-27
3
Stress Events
mean
min
max
Fall2015
0.00%
0.00%
0.00%
New Normal
0.04%
-9.81%
10.26%
Top 10 long positions of all time
max
sid
600019
105.23%
Top 10 short positions of all time
max
sid
Top 10 positions of all time
max
sid
600019
105.23%
Summary stats
All trades
Long trades
Total number of round_trips
10.00
10.00
Percent profitable
0.40
0.40
Winning round_trips
4.00
4.00
Losing round_trips
6.00
6.00
Even round_trips
0.00
0.00
PnL stats
All trades
Long trades
Total profit
$8871.42
$8871.42
Gross profit
$61639.55
$61639.55
Gross loss
$-52768.13
$-52768.13
Profit factor
$1.17
$1.17
Avg. trade net profit
$887.14
$887.14
Avg. winning trade
$15409.89
$15409.89
Avg. losing trade
$-8794.69
$-8794.69
Ratio Avg. Win:Avg. Loss
$1.75
$1.75
Largest winning trade
$25403.68
$25403.68
Largest losing trade
$-14166.90
$-14166.90
Duration stats
All trades
Long trades
Avg duration
54 days 16:06:00.100000
54 days 16:06:00.100000
Median duration
30 days 20:30:00.500000
30 days 20:30:00.500000
Longest duration
165 days 00:00:00
165 days 00:00:00
Shortest duration
1 days 00:00:00
1 days 00:00:00
Return stats
All trades
Long trades
Avg returns all round_trips
7.02%
7.02%
Avg returns winning
7.02%
7.02%
Avg returns losing
nan%
nan%
Median returns all round_trips
7.02%
7.02%
Median returns winning
7.02%
7.02%
Median returns losing
nan%
nan%
Largest winning trade
7.02%
7.02%
Largest losing trade
7.02%
7.02%
Symbol stats
600019
Avg returns all round_trips
7.02%
Avg returns winning
7.02%
Avg returns losing
nan%
Median returns all round_trips
7.02%
Median returns winning
7.02%
Median returns losing
nan%
Largest winning trade
7.02%
Largest losing trade
7.02%
Profitability (PnL / PnL total) per name
symbol
600019
100.00%
In [ ]:
Content source: stonewell/learn-curve
Similar notebooks: