Kernel: SageMath (stable)
Testing Mean Reversion Code
In [7]:
In [8]:
In [9]:
In [10]:
In [11]:
In [12]:
/ext/anaconda3/lib/python3.5/site-packages/statsmodels/compat/pandas.py:56: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
from pandas.core import datetools
In [13]:
In [14]:
In [15]:
In [16]:
In [17]:
In [18]:
In [19]:
In [20]:
Date | SPX | AAPL | MSFT | GOOG | AMZN | FB | SBUX | |
---|---|---|---|---|---|---|---|---|
0 | 2000-08-31 | 1517.680054 | 2.935255 | 25.539095 | NaN | 41.5000 | NaN | 3.735864 |
1 | 2000-09-01 | 1520.770020 | 3.055676 | 25.676279 | NaN | 41.5000 | NaN | 3.844242 |
2 | 2000-09-05 | 1507.079956 | 3.007508 | 25.653412 | NaN | 45.6875 | NaN | 3.837867 |
3 | 2000-09-06 | 1492.250000 | 2.814835 | 25.401903 | NaN | 45.8750 | NaN | 3.767739 |
4 | 2000-09-07 | 1502.510010 | 2.986434 | 25.630543 | NaN | 43.5000 | NaN | 3.837867 |
In [21]:
In [22]:
<class 'pandas.core.frame.DataFrame'>
SPX | AAPL | MSFT | GOOG | AMZN | FB | SBUX | SPX_ret | AAPL_ret | MSFT_ret | ... | AMZN_ret_HV21_vol_prem | FB_ret_HV21_vol_prem | SBUX_ret_HV21_vol_prem | SPX_ret_Vcorr | AAPL_ret_Vcorr | MSFT_ret_Vcorr | GOOG_ret_Vcorr | AMZN_ret_Vcorr | FB_ret_Vcorr | SBUX_ret_Vcorr | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
count | 4442.000000 | 4442.000000 | 4442.000000 | 3448.000000 | 4442.000000 | 1496.000000 | 4442.000000 | 4441.000000 | 4441.000000 | 4441.000000 | ... | 3723.000000 | 1136.000000 | 3723.000000 | 4.190000e+03 | 4190.000000 | 4190.000000 | 3196.000000 | 4190.000000 | 1244.000000 | 4190.000000 |
mean | 1458.840833 | 41.359003 | 29.691175 | 406.808014 | 239.160950 | 90.675635 | 20.903147 | 0.000198 | 0.001241 | 0.000466 | ... | 21.959204 | 19.149914 | 11.369873 | 1.000000e+00 | 0.535958 | 0.647527 | 0.573460 | 0.499291 | 0.473103 | 0.574429 |
std | 466.505382 | 48.123965 | 16.563054 | 256.515001 | 309.531626 | 49.050331 | 18.269219 | 0.012050 | 0.025153 | 0.018710 | ... | 9.674753 | 10.134565 | 7.060319 | 1.295721e-14 | 0.129706 | 0.121225 | 0.129951 | 0.092332 | 0.149839 | 0.106975 |
min | 676.530029 | 0.631968 | 12.002091 | 49.681866 | 5.970000 | 17.730000 | 2.856087 | -0.090350 | -0.518691 | -0.118155 | ... | 4.831570 | 4.221414 | -0.477096 | 1.000000e+00 | 0.193932 | 0.364624 | 0.086375 | 0.298710 | 0.082368 | 0.234126 |
25% | 1131.440033 | 3.426210 | 20.062912 | 229.441452 | 38.905001 | 49.689999 | 6.667941 | -0.004764 | -0.010371 | -0.008068 | ... | 14.349202 | 11.526887 | 6.827820 | 1.000000e+00 | 0.434108 | 0.577042 | 0.505172 | 0.426852 | 0.442305 | 0.500515 |
50% | 1309.825012 | 17.599251 | 22.606724 | 298.446395 | 89.005001 | 81.975003 | 12.474978 | 0.000538 | 0.000765 | 0.000117 | ... | 21.428194 | 16.117665 | 9.167523 | 1.000000e+00 | 0.546415 | 0.665509 | 0.589889 | 0.487428 | 0.523660 | 0.571625 |
75% | 1782.164978 | 66.533138 | 32.544173 | 555.451157 | 306.270004 | 125.405000 | 33.679004 | 0.005616 | 0.012922 | 0.008630 | ... | 27.531779 | 32.496460 | 14.903605 | 1.000000e+00 | 0.651333 | 0.748857 | 0.659155 | 0.555657 | 0.564986 | 0.648543 |
max | 2872.870117 | 181.021957 | 96.352371 | 1175.839966 | 1598.390015 | 193.089996 | 63.265320 | 0.115800 | 0.139050 | 0.195652 | ... | 45.250383 | 38.788546 | 33.339979 | 1.000000e+00 | 0.750971 | 0.819369 | 0.825443 | 0.761214 | 0.673141 | 0.786925 |
8 rows × 35 columns
In [23]:
Populating the interactive namespace from numpy and matplotlib
/ext/anaconda3/lib/python3.5/site-packages/IPython/core/magics/pylab.py:160: UserWarning: pylab import has clobbered these variables: ['datetime']
`%matplotlib` prevents importing * from pylab and numpy
"\n`%matplotlib` prevents importing * from pylab and numpy"
<matplotlib.axes._subplots.AxesSubplot at 0x7fb0b21b54e0>
WARNING: Some output was deleted.
In [24]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb0b1de2320>
WARNING: Some output was deleted.
In [25]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb0b1ff3470>
WARNING: Some output was deleted.
In [26]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb0b1f56908>
WARNING: Some output was deleted.
In [27]:
In [28]:
In [29]:
-0.029860508371503839
In [30]:
<matplotlib.axes._subplots.AxesSubplot at 0x7fb0b1df9278>
WARNING: Some output was deleted.
In [31]:
In [32]:
In [34]:
0.0010023252339726358
In [35]:
In [36]:
Date
2000-08-31 2.935255
2000-09-01 3.055676
2000-09-05 3.007508
2000-09-06 2.814835
2000-09-07 2.986434
Name: AAPL, dtype: float64
In [37]:
Date
2008-08-25 16.622875
2008-08-26 16.727882
2008-08-27 16.827114
2008-08-28 16.737513
2008-08-29 16.331944
Name: AAPL, dtype: float64
In [38]:
0.00350593165566435
In [39]:
In [40]:
-0.0052954428489820054
In [41]:
WARNING: Some output was deleted.
In [42]:
In [43]:
-0.0067036462086532758
In [0]: