Hi all, I am new to the Quantopian environment and programming in general..I stumbled upon this thread while trying to do something similar...
I created a dummy pandas series with dummy dates as the index:
rng = pd.date_range('1/1/2011', periods=72, freq='H')
ds = pd.Series(np.random.randn(len(rng)),index=rng)
pf.create_full_tear_sheet(ds)
And this was the traceback I got:
Traceback (most recent call last):
File "C:\Users\Admin\Desktop\vfsdvf - Copy.py", line 21, in
pf.create_full_tear_sheet(ds)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pyfolio\tears.py", line 181, in create_full_tear_sheet
set_context=set_context)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pyfolio\plotting.py", line 52, in call_w_context
return func(*args, **kwargs)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\pyfolio\tears.py", line 448, in create_returns_tear_sheet
print("Entire data start date: %s" % returns.index[0].strftime('%Y-%m-%d'))
File "C:\Users\Admin\AppData\Roaming\Python\Python35\site-packages\pandas\core\indexes\datetimelike.py", line 271, in getitem
val = getitem(key)
File "C:\Users\Admin\AppData\Roaming\Python\Python35\site-packages\pandas\core\indexes\datetimelike.py", line 271, in getitem
val = getitem(key)
IndexError: index 0 is out of bounds for axis 0 with size 0
For more additional information:
ds.shape returns (72,)
ds.values returns:
array([ 0.08757005, -1.64412178, 1.15709941, -1.40537281, -0.80301942,
-0.29192278, 0.79053923, 0.55517532, 1.31618401, 0.03126079,
1.78018401, 0.09569176, 1.69468017, -0.15662507, 1.485865 ,
1.569107 , -1.09783896, 0.69884955, -0.20707769, 1.66601113,
-0.81318518, 1.15245775, 0.71799803, -1.48395817, 0.01577633,
0.1703878 , 0.37311332, -1.34285804, 0.46429777, 0.46173365,
0.23048052, 0.92245259, 1.21407195, 0.60010088, -0.53904102,
0.45358215, -0.62620881, -0.18269723, 0.23558362, -0.54613381,
1.09732697, 1.16196203, 1.19318663, -0.76692525, 0.09429309,
2.69763578, 1.4291762 , -0.64370414, -1.2974987 , 0.6832096 ,
2.59073877, 0.62590452, -0.88126909, -0.35983966, -0.92860179,
1.91045484, 0.35842119, -0.64363602, -0.74889649, 0.18456287,
0.5578629 , -0.01115962, -1.59089233, 0.87541127, 0.2891369 ,
-0.97425595, -0.01576838, -0.95861673, 0.42297133, 0.55638081,
0.52022179, 2.21036512])
ds.index returns:
DatetimeIndex(['2011-01-01 00:00:00', '2011-01-01 01:00:00',
'2011-01-01 02:00:00', '2011-01-01 03:00:00',
'2011-01-01 04:00:00', '2011-01-01 05:00:00',
'2011-01-01 06:00:00', '2011-01-01 07:00:00',
'2011-01-01 08:00:00', '2011-01-01 09:00:00',
'2011-01-01 10:00:00', '2011-01-01 11:00:00',
'2011-01-01 12:00:00', '2011-01-01 13:00:00',
'2011-01-01 14:00:00', '2011-01-01 15:00:00',
'2011-01-01 16:00:00', '2011-01-01 17:00:00',
'2011-01-01 18:00:00', '2011-01-01 19:00:00',
'2011-01-01 20:00:00', '2011-01-01 21:00:00',
'2011-01-01 22:00:00', '2011-01-01 23:00:00',
'2011-01-02 00:00:00', '2011-01-02 01:00:00',
'2011-01-02 02:00:00', '2011-01-02 03:00:00',
'2011-01-02 04:00:00', '2011-01-02 05:00:00',
'2011-01-02 06:00:00', '2011-01-02 07:00:00',
'2011-01-02 08:00:00', '2011-01-02 09:00:00',
'2011-01-02 10:00:00', '2011-01-02 11:00:00',
'2011-01-02 12:00:00', '2011-01-02 13:00:00',
'2011-01-02 14:00:00', '2011-01-02 15:00:00',
'2011-01-02 16:00:00', '2011-01-02 17:00:00',
'2011-01-02 18:00:00', '2011-01-02 19:00:00',
'2011-01-02 20:00:00', '2011-01-02 21:00:00',
'2011-01-02 22:00:00', '2011-01-02 23:00:00',
'2011-01-03 00:00:00', '2011-01-03 01:00:00',
'2011-01-03 02:00:00', '2011-01-03 03:00:00',
'2011-01-03 04:00:00', '2011-01-03 05:00:00',
'2011-01-03 06:00:00', '2011-01-03 07:00:00',
'2011-01-03 08:00:00', '2011-01-03 09:00:00',
'2011-01-03 10:00:00', '2011-01-03 11:00:00',
'2011-01-03 12:00:00', '2011-01-03 13:00:00',
'2011-01-03 14:00:00', '2011-01-03 15:00:00',
'2011-01-03 16:00:00', '2011-01-03 17:00:00',
'2011-01-03 18:00:00', '2011-01-03 19:00:00',
'2011-01-03 20:00:00', '2011-01-03 21:00:00',
'2011-01-03 22:00:00', '2011-01-03 23:00:00'],
dtype='datetime64[ns]', freq='H')
```
The series above behaves in more or less the same way as if I use
pf.utils.get_symbol_rets('SPY')
which generates the tear sheet. So I'm not really sure what I am doing different here..will appreciate any inputs and discussion! =)