TA-Lib Tutorial

"TA-Lib is widely used by trading software developers requiring to perform technical analysis of financial market data."
We will show how to use them here, in the context of pinkfish.


In [74]:
%%javascript
IPython.OutputArea.prototype._should_scroll = function(lines) {
    return false;
}



In [75]:
import pandas as pd
import matplotlib.pyplot as plt
import datetime
import talib
from talib.abstract import *
from talib import MA_Type
import itable

import pinkfish as pf

# format price data
pd.options.display.float_format = '{:0.3f}'.format

%matplotlib inline

In [76]:
# set size of inline plots
'''note: rcParams can't be in same cell as import matplotlib
   or %matplotlib inline
   
   %matplotlib notebook: will lead to interactive plots embedded within
   the notebook, you can zoom and resize the figure
   
   %matplotlib inline: only draw static images in the notebook
'''
plt.rcParams["figure.figsize"] = (10, 7)

Some global data


In [77]:
symbol = 'SPY'
start = datetime.datetime(2018, 1, 1)
end = datetime.datetime.now()

Fetch symbol data from cache, if available.


In [78]:
ts = pf.fetch_timeseries(symbol)

In [79]:
ts.tail()


Out[79]:
high low open close volume adj_close
date
2020-07-09 317.100 310.680 316.840 314.380 83354200.000 314.380
2020-07-10 317.880 312.760 314.310 317.590 57550400.000 317.590
2020-07-13 322.710 314.130 320.130 314.840 102997500.000 314.840
2020-07-14 319.760 312.000 313.300 318.920 93657000.000 318.920
2020-07-15 323.040 319.270 322.410 321.850 86896400.000 321.850

Select timeseries between start and end.


In [80]:
ts = pf.select_tradeperiod(ts, start, end)

In [81]:
ts.head()


Out[81]:
high low open close volume adj_close
date
2017-01-03 225.830 223.880 225.040 225.240 91366500.000 210.626
2017-01-04 226.750 225.610 225.620 226.580 78744400.000 211.879
2017-01-05 226.580 225.480 226.270 226.400 78379000.000 211.710
2017-01-06 227.750 225.900 226.530 227.210 71559900.000 212.468
2017-01-09 227.070 226.420 226.910 226.460 46939700.000 211.767

Get info about TA-Lib


In [82]:
print('There are {} TA-Lib functions!'.format(len(talib.get_functions())))


There are 158 TA-Lib functions!

Here is a complete listing of the functions by group:


In [83]:
for group, funcs in talib.get_function_groups().items():
    print(group)
    print('-----------------------------------------')
    for func in funcs:
        f = Function(func)
        print('{} - {}'.format(func, f.info['display_name']))
    print()


Cycle Indicators
-----------------------------------------
HT_DCPERIOD - Hilbert Transform - Dominant Cycle Period
HT_DCPHASE - Hilbert Transform - Dominant Cycle Phase
HT_PHASOR - Hilbert Transform - Phasor Components
HT_SINE - Hilbert Transform - SineWave
HT_TRENDMODE - Hilbert Transform - Trend vs Cycle Mode

Math Operators
-----------------------------------------
ADD - Vector Arithmetic Add
DIV - Vector Arithmetic Div
MAX - Highest value over a specified period
MAXINDEX - Index of highest value over a specified period
MIN - Lowest value over a specified period
MININDEX - Index of lowest value over a specified period
MINMAX - Lowest and highest values over a specified period
MINMAXINDEX - Indexes of lowest and highest values over a specified period
MULT - Vector Arithmetic Mult
SUB - Vector Arithmetic Substraction
SUM - Summation

Math Transform
-----------------------------------------
ACOS - Vector Trigonometric ACos
ASIN - Vector Trigonometric ASin
ATAN - Vector Trigonometric ATan
CEIL - Vector Ceil
COS - Vector Trigonometric Cos
COSH - Vector Trigonometric Cosh
EXP - Vector Arithmetic Exp
FLOOR - Vector Floor
LN - Vector Log Natural
LOG10 - Vector Log10
SIN - Vector Trigonometric Sin
SINH - Vector Trigonometric Sinh
SQRT - Vector Square Root
TAN - Vector Trigonometric Tan
TANH - Vector Trigonometric Tanh

Momentum Indicators
-----------------------------------------
ADX - Average Directional Movement Index
ADXR - Average Directional Movement Index Rating
APO - Absolute Price Oscillator
AROON - Aroon
AROONOSC - Aroon Oscillator
BOP - Balance Of Power
CCI - Commodity Channel Index
CMO - Chande Momentum Oscillator
DX - Directional Movement Index
MACD - Moving Average Convergence/Divergence
MACDEXT - MACD with controllable MA type
MACDFIX - Moving Average Convergence/Divergence Fix 12/26
MFI - Money Flow Index
MINUS_DI - Minus Directional Indicator
MINUS_DM - Minus Directional Movement
MOM - Momentum
PLUS_DI - Plus Directional Indicator
PLUS_DM - Plus Directional Movement
PPO - Percentage Price Oscillator
ROC - Rate of change : ((price/prevPrice)-1)*100
ROCP - Rate of change Percentage: (price-prevPrice)/prevPrice
ROCR - Rate of change ratio: (price/prevPrice)
ROCR100 - Rate of change ratio 100 scale: (price/prevPrice)*100
RSI - Relative Strength Index
STOCH - Stochastic
STOCHF - Stochastic Fast
STOCHRSI - Stochastic Relative Strength Index
TRIX - 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA
ULTOSC - Ultimate Oscillator
WILLR - Williams' %R

Overlap Studies
-----------------------------------------
BBANDS - Bollinger Bands
DEMA - Double Exponential Moving Average
EMA - Exponential Moving Average
HT_TRENDLINE - Hilbert Transform - Instantaneous Trendline
KAMA - Kaufman Adaptive Moving Average
MA - Moving average
MAMA - MESA Adaptive Moving Average
MAVP - Moving average with variable period
MIDPOINT - MidPoint over period
MIDPRICE - Midpoint Price over period
SAR - Parabolic SAR
SAREXT - Parabolic SAR - Extended
SMA - Simple Moving Average
T3 - Triple Exponential Moving Average (T3)
TEMA - Triple Exponential Moving Average
TRIMA - Triangular Moving Average
WMA - Weighted Moving Average

Pattern Recognition
-----------------------------------------
CDL2CROWS - Two Crows
CDL3BLACKCROWS - Three Black Crows
CDL3INSIDE - Three Inside Up/Down
CDL3LINESTRIKE - Three-Line Strike 
CDL3OUTSIDE - Three Outside Up/Down
CDL3STARSINSOUTH - Three Stars In The South
CDL3WHITESOLDIERS - Three Advancing White Soldiers
CDLABANDONEDBABY - Abandoned Baby
CDLADVANCEBLOCK - Advance Block
CDLBELTHOLD - Belt-hold
CDLBREAKAWAY - Breakaway
CDLCLOSINGMARUBOZU - Closing Marubozu
CDLCONCEALBABYSWALL - Concealing Baby Swallow
CDLCOUNTERATTACK - Counterattack
CDLDARKCLOUDCOVER - Dark Cloud Cover
CDLDOJI - Doji
CDLDOJISTAR - Doji Star
CDLDRAGONFLYDOJI - Dragonfly Doji
CDLENGULFING - Engulfing Pattern
CDLEVENINGDOJISTAR - Evening Doji Star
CDLEVENINGSTAR - Evening Star
CDLGAPSIDESIDEWHITE - Up/Down-gap side-by-side white lines
CDLGRAVESTONEDOJI - Gravestone Doji
CDLHAMMER - Hammer
CDLHANGINGMAN - Hanging Man
CDLHARAMI - Harami Pattern
CDLHARAMICROSS - Harami Cross Pattern
CDLHIGHWAVE - High-Wave Candle
CDLHIKKAKE - Hikkake Pattern
CDLHIKKAKEMOD - Modified Hikkake Pattern
CDLHOMINGPIGEON - Homing Pigeon
CDLIDENTICAL3CROWS - Identical Three Crows
CDLINNECK - In-Neck Pattern
CDLINVERTEDHAMMER - Inverted Hammer
CDLKICKING - Kicking
CDLKICKINGBYLENGTH - Kicking - bull/bear determined by the longer marubozu
CDLLADDERBOTTOM - Ladder Bottom
CDLLONGLEGGEDDOJI - Long Legged Doji
CDLLONGLINE - Long Line Candle
CDLMARUBOZU - Marubozu
CDLMATCHINGLOW - Matching Low
CDLMATHOLD - Mat Hold
CDLMORNINGDOJISTAR - Morning Doji Star
CDLMORNINGSTAR - Morning Star
CDLONNECK - On-Neck Pattern
CDLPIERCING - Piercing Pattern
CDLRICKSHAWMAN - Rickshaw Man
CDLRISEFALL3METHODS - Rising/Falling Three Methods
CDLSEPARATINGLINES - Separating Lines
CDLSHOOTINGSTAR - Shooting Star
CDLSHORTLINE - Short Line Candle
CDLSPINNINGTOP - Spinning Top
CDLSTALLEDPATTERN - Stalled Pattern
CDLSTICKSANDWICH - Stick Sandwich
CDLTAKURI - Takuri (Dragonfly Doji with very long lower shadow)
CDLTASUKIGAP - Tasuki Gap
CDLTHRUSTING - Thrusting Pattern
CDLTRISTAR - Tristar Pattern
CDLUNIQUE3RIVER - Unique 3 River
CDLUPSIDEGAP2CROWS - Upside Gap Two Crows
CDLXSIDEGAP3METHODS - Upside/Downside Gap Three Methods

Price Transform
-----------------------------------------
AVGPRICE - Average Price
MEDPRICE - Median Price
TYPPRICE - Typical Price
WCLPRICE - Weighted Close Price

Statistic Functions
-----------------------------------------
BETA - Beta
CORREL - Pearson's Correlation Coefficient (r)
LINEARREG - Linear Regression
LINEARREG_ANGLE - Linear Regression Angle
LINEARREG_INTERCEPT - Linear Regression Intercept
LINEARREG_SLOPE - Linear Regression Slope
STDDEV - Standard Deviation
TSF - Time Series Forecast
VAR - Variance

Volatility Indicators
-----------------------------------------
ATR - Average True Range
NATR - Normalized Average True Range
TRANGE - True Range

Volume Indicators
-----------------------------------------
AD - Chaikin A/D Line
ADOSC - Chaikin A/D Oscillator
OBV - On Balance Volume

Get info about a specific TA-Lib function

There are 2 different API that are available with talib, namely Function API and Abstract API. For the Function API, you pass in a price series. For the Abstract API, you pass in a collection of named inputs: 'open', 'high', 'low', 'close', and 'volume'. One or more of these may be used as defaults, but can be changed with the 'price' parameter.

Print the function instance to get documentation. We see that SMA has the parameter 'timeperiod' with default '30'. The input_arrays can be a dataframe with columns named 'open', 'high', 'low', 'close', and 'volume'.


In [84]:
print(SMA)


SMA([input_arrays], [timeperiod=200])

Simple Moving Average (Overlap Studies)

Inputs:
    price: (any ndarray)
Parameters:
    timeperiod: 200
Outputs:
    real

More information is available through the 'info' property. We observe here that the default price used is 'close'. This can be changed by setting 'price' in the function call, e.g. price='open'.


In [85]:
print(SMA.info)


{'name': 'SMA', 'group': 'Overlap Studies', 'display_name': 'Simple Moving Average', 'function_flags': ['Output scale same as input'], 'input_names': OrderedDict([('price', 'open')]), 'parameters': OrderedDict([('timeperiod', 200)]), 'output_flags': OrderedDict([('real', ['Line'])]), 'output_names': ['real']}

If we just want to see the inputs, we can print the input_names property.


In [86]:
print(SMA.input_names)


OrderedDict([('price', 'open')])

If we just want to see the parameters, we can print the paramters property.


In [87]:
print(SMA.parameters)


OrderedDict([('timeperiod', 200)])

If we just want to see the outputs, we can print the output_names property.


In [88]:
print(SMA.output_names)


['real']

Create a technical indicator using talib

Create technical indicator: SMA (using defaults: timeperiod=30, price='close')


In [89]:
sma = SMA(ts)
sma.tail()


Out[89]:
date
2020-07-09   302.063
2020-07-10   302.137
2020-07-13   302.258
2020-07-14   302.336
2020-07-15   302.459
dtype: float64

Create technical indicator: SMA (using: timeperiod=200, price='close')


In [90]:
sma200 = SMA(ts, timeperiod=200)
sma200.tail()


Out[90]:
date
2020-07-09   302.063
2020-07-10   302.137
2020-07-13   302.258
2020-07-14   302.336
2020-07-15   302.459
dtype: float64

Create technical indicator: SMA (using: timeperiod=200, price='open')


In [91]:
sma200 = SMA(ts, timeperiod=200, price='open')
sma200.tail()


Out[91]:
date
2020-07-09   302.063
2020-07-10   302.137
2020-07-13   302.258
2020-07-14   302.336
2020-07-15   302.459
dtype: float64

Add a technical indicator to a pinkfish timeseries


In [92]:
ts['sma200'] = sma200
ts.tail()


Out[92]:
high low open close volume adj_close sma200
date
2020-07-09 317.100 310.680 316.840 314.380 83354200.000 314.380 302.063
2020-07-10 317.880 312.760 314.310 317.590 57550400.000 317.590 302.137
2020-07-13 322.710 314.130 320.130 314.840 102997500.000 314.840 302.258
2020-07-14 319.760 312.000 313.300 318.920 93657000.000 318.920 302.336
2020-07-15 323.040 319.270 322.410 321.850 86896400.000 321.850 302.459

Try another one

Commodity Channel Index


In [93]:
print(CCI)


CCI([input_arrays], [timeperiod=14])

Commodity Channel Index (Momentum Indicators)

Inputs:
    prices: ['high', 'low', 'close']
Parameters:
    timeperiod: 14
Outputs:
    real

In [94]:
print(CCI.input_names)


OrderedDict([('prices', ['high', 'low', 'close'])])

In [95]:
print(CCI.parameters)


OrderedDict([('timeperiod', 14)])

In [96]:
cci = CCI(ts)
ts['cci'] = cci
ts.tail()


Out[96]:
high low open close volume adj_close sma200 cci
date
2020-07-09 317.100 310.680 316.840 314.380 83354200.000 314.380 302.063 69.704
2020-07-10 317.880 312.760 314.310 317.590 57550400.000 317.590 302.137 88.378
2020-07-13 322.710 314.130 320.130 314.840 102997500.000 314.840 302.258 90.696
2020-07-14 319.760 312.000 313.300 318.920 93657000.000 318.920 302.336 77.263
2020-07-15 323.040 319.270 322.410 321.850 86896400.000 321.850 302.459 123.577

Now for something a little more difficult

Bollinger Bands


In [97]:
print(BBANDS)


BBANDS([input_arrays], [timeperiod=5], [nbdevup=2], [nbdevdn=2], [matype=0])

Bollinger Bands (Overlap Studies)

Inputs:
    price: (any ndarray)
Parameters:
    timeperiod: 5
    nbdevup: 2
    nbdevdn: 2
    matype: 0 (Simple Moving Average)
Outputs:
    upperband
    middleband
    lowerband

In [98]:
print(BBANDS.input_names)


OrderedDict([('price', 'close')])

In [99]:
print(BBANDS.parameters)


OrderedDict([('timeperiod', 5), ('nbdevup', 2), ('nbdevdn', 2), ('matype', 0)])

Print the available moving average types


In [100]:
attributes = [attr for attr in dir(MA_Type) 
              if not attr.startswith('__')]
attributes


Out[100]:
['DEMA', 'EMA', 'KAMA', 'MAMA', 'SMA', 'T3', 'TEMA', 'TRIMA', 'WMA', '_lookup']

In [101]:
MA_Type.__dict__


Out[101]:
{'_lookup': {0: 'Simple Moving Average',
  1: 'Exponential Moving Average',
  2: 'Weighted Moving Average',
  3: 'Double Exponential Moving Average',
  4: 'Triple Exponential Moving Average',
  5: 'Triangular Moving Average',
  6: 'Kaufman Adaptive Moving Average',
  7: 'MESA Adaptive Moving Average',
  8: 'Triple Generalized Double Exponential Moving Average'}}

In [102]:
print(MA_Type[MA_Type.DEMA])


Double Exponential Moving Average

Set timeperiod=20 and matype=MA_Type.EMA


In [103]:
#upper, middle, lower = BBANDS(ts, timeperiod=20, matype=MA_Type.EMA)
#(for some reason, the abstract API doesn't work for BBANDS, so use the function API)

upper, middle, lower = talib.BBANDS(ts.close, timeperiod=20, matype=MA_Type.EMA)
ts['upper'] = upper; ts['middle'] = middle; ts['lower'] = lower
ts.tail()


Out[103]:
high low open close volume adj_close sma200 cci upper middle lower
date
2020-07-09 317.100 310.680 316.840 314.380 83354200.000 314.380 302.063 69.704 319.598 310.161 300.724
2020-07-10 317.880 312.760 314.310 317.590 57550400.000 317.590 302.137 88.378 320.041 310.869 301.697
2020-07-13 322.710 314.130 320.130 314.840 102997500.000 314.840 302.258 90.696 320.186 311.247 302.307
2020-07-14 319.760 312.000 313.300 318.920 93657000.000 318.920 302.336 77.263 321.410 311.978 302.546
2020-07-15 323.040 319.270 322.410 321.850 86896400.000 321.850 302.459 123.577 323.388 312.918 302.448

In [104]:
print(MOM)


MOM([input_arrays], [timeperiod=10])

Momentum (Momentum Indicators)

Inputs:
    price: (any ndarray)
Parameters:
    timeperiod: 10
Outputs:
    real

In [105]:
mom10 = MOM(ts, timeperiod=10)
mom10.tail()


Out[105]:
date
2020-07-09   10.290
2020-07-10   10.240
2020-07-13   14.790
2020-07-14   14.460
2020-07-15   13.490
dtype: float64

In [106]:
ts['mom10'] = mom10
ts.head(50)


Out[106]:
high low open close volume adj_close sma200 cci upper middle lower mom10
date
2017-01-03 225.830 223.880 225.040 225.240 91366500.000 210.626 nan nan nan nan nan nan
2017-01-04 226.750 225.610 225.620 226.580 78744400.000 211.879 nan nan nan nan nan nan
2017-01-05 226.580 225.480 226.270 226.400 78379000.000 211.710 nan nan nan nan nan nan
2017-01-06 227.750 225.900 226.530 227.210 71559900.000 212.468 nan nan nan nan nan nan
2017-01-09 227.070 226.420 226.910 226.460 46939700.000 211.767 nan nan nan nan nan nan
2017-01-10 227.450 226.010 226.480 226.460 63771900.000 211.767 nan nan nan nan nan nan
2017-01-11 227.100 225.590 226.360 227.100 74650000.000 212.365 nan nan nan nan nan nan
2017-01-12 226.750 224.960 226.500 226.530 72113200.000 211.832 nan nan nan nan nan nan
2017-01-13 227.400 226.690 226.730 227.050 62717900.000 212.318 nan nan nan nan nan nan
2017-01-17 226.780 225.800 226.310 226.250 61240800.000 211.570 nan nan nan nan nan nan
2017-01-18 226.800 225.900 226.540 226.750 54793300.000 212.038 nan nan nan nan nan 1.510
2017-01-19 227.000 225.410 226.840 225.910 66608800.000 211.252 nan nan nan nan nan -0.670
2017-01-20 227.310 225.970 226.700 226.740 129168600.000 212.028 nan nan nan nan nan 0.340
2017-01-23 226.810 225.270 226.740 226.150 75061600.000 211.477 nan -52.243 nan nan nan -1.060
2017-01-24 228.080 226.270 226.400 227.600 95555300.000 212.833 nan 168.187 nan nan nan 1.140
2017-01-25 229.570 228.510 228.700 229.570 84437700.000 214.675 nan 321.968 nan nan nan 3.110
2017-01-26 229.710 229.010 229.400 229.330 59970700.000 214.450 nan 219.276 nan nan nan 2.230
2017-01-27 229.590 228.760 229.420 228.970 59711100.000 214.114 nan 142.345 nan nan nan 2.440
2017-01-30 228.200 226.410 228.170 227.550 79737300.000 212.786 nan 15.591 nan nan nan 0.500
2017-01-31 227.600 226.320 226.980 227.530 75880800.000 212.767 nan -4.022 229.254 227.069 224.884 1.280
2017-02-01 228.590 226.940 227.530 227.620 79117700.000 212.851 nan 31.568 229.148 227.121 225.095 0.870
2017-02-02 228.100 226.820 227.620 227.770 69657600.000 212.991 nan 13.427 229.205 227.183 225.162 1.860
2017-02-03 229.550 228.460 228.820 229.340 80563200.000 214.460 nan 107.690 229.564 227.389 225.213 2.600
2017-02-06 229.330 228.540 228.870 228.930 57790100.000 214.076 nan 79.407 229.809 227.535 225.262 2.780
2017-02-07 229.660 228.720 229.380 228.940 57931200.000 214.086 nan 75.763 229.977 227.669 225.362 1.340
2017-02-08 229.390 228.310 228.940 229.240 51566200.000 214.366 nan 57.571 230.168 227.819 225.469 -0.330
2017-02-09 230.950 229.240 229.240 230.600 65955200.000 215.638 nan 124.763 230.719 228.084 225.448 1.270
2017-02-10 231.770 230.620 231.000 231.510 66015900.000 216.489 nan 179.751 231.392 228.410 225.428 2.540
2017-02-13 233.070 232.050 232.080 232.770 55182100.000 217.667 nan 229.724 232.368 228.825 225.282 5.220
2017-02-14 233.710 232.160 232.560 233.700 71109000.000 218.537 nan 181.148 233.355 229.290 225.224 6.170
2017-02-15 235.140 233.390 233.450 234.920 86785800.000 219.678 nan 169.285 234.562 229.826 225.090 7.300
2017-02-16 235.160 233.850 234.950 234.720 84722400.000 219.491 nan 133.359 235.338 230.292 225.246 6.950
2017-02-17 235.090 233.930 233.950 235.090 77204100.000 219.837 nan 111.905 236.125 230.749 225.373 5.750
2017-02-21 236.690 235.510 235.520 236.490 88946100.000 221.146 nan 128.435 237.033 231.296 225.559 7.560
2017-02-22 236.540 235.830 236.020 236.280 62115200.000 220.949 nan 108.323 237.835 231.770 225.706 7.340
2017-02-23 236.900 235.560 236.880 236.440 74615900.000 221.099 nan 98.019 238.672 232.215 225.758 7.200
2017-02-24 236.790 235.410 235.460 236.740 82381600.000 221.380 nan 86.951 239.431 232.646 225.861 6.140
2017-02-27 237.310 236.350 236.640 237.110 56515400.000 221.725 nan 92.456 240.110 233.071 226.032 5.600
2017-02-28 236.950 236.020 236.670 236.470 96961900.000 221.127 nan 73.549 240.337 233.395 226.452 3.700
2017-03-01 240.320 238.370 238.390 239.780 149158200.000 224.222 nan 158.568 241.201 234.003 226.805 6.080
2017-03-02 239.570 238.210 239.560 238.270 70246000.000 222.810 nan 118.986 241.445 234.409 227.374 3.350
2017-03-03 238.610 237.730 238.170 238.420 81974300.000 222.951 nan 97.847 241.540 234.791 228.042 3.700
2017-03-06 238.120 237.010 237.500 237.710 55391500.000 222.287 nan 62.714 241.573 235.069 228.566 2.620
2017-03-07 237.770 236.760 237.360 237.000 65103700.000 221.623 nan 28.956 241.255 235.253 229.251 0.510
2017-03-08 237.640 236.400 237.340 236.560 78168800.000 221.211 nan 1.441 240.692 235.378 230.063 0.280
2017-03-09 237.240 235.740 236.700 236.860 90683900.000 221.492 nan -28.072 240.016 235.519 231.021 0.420
2017-03-10 238.020 236.590 237.970 237.690 81991700.000 222.268 nan 20.872 239.576 235.726 231.875 0.950
2017-03-13 237.860 237.240 237.620 237.810 57256800.000 222.380 nan 30.353 239.162 235.924 232.686 0.700
2017-03-14 237.240 236.190 237.180 236.900 59880800.000 221.529 nan -49.697 238.754 236.017 233.280 0.430
2017-03-15 239.440 237.290 237.560 238.950 96081800.000 223.446 nan 94.220 238.812 236.296 233.781 -0.830

In [107]:
m1 = ts['close'].pct_change(periods=10)
ts['m1'] = m1
ts.head(50)


Out[107]:
high low open close volume adj_close sma200 cci upper middle lower mom10 m1
date
2017-01-03 225.830 223.880 225.040 225.240 91366500.000 210.626 nan nan nan nan nan nan nan
2017-01-04 226.750 225.610 225.620 226.580 78744400.000 211.879 nan nan nan nan nan nan nan
2017-01-05 226.580 225.480 226.270 226.400 78379000.000 211.710 nan nan nan nan nan nan nan
2017-01-06 227.750 225.900 226.530 227.210 71559900.000 212.468 nan nan nan nan nan nan nan
2017-01-09 227.070 226.420 226.910 226.460 46939700.000 211.767 nan nan nan nan nan nan nan
2017-01-10 227.450 226.010 226.480 226.460 63771900.000 211.767 nan nan nan nan nan nan nan
2017-01-11 227.100 225.590 226.360 227.100 74650000.000 212.365 nan nan nan nan nan nan nan
2017-01-12 226.750 224.960 226.500 226.530 72113200.000 211.832 nan nan nan nan nan nan nan
2017-01-13 227.400 226.690 226.730 227.050 62717900.000 212.318 nan nan nan nan nan nan nan
2017-01-17 226.780 225.800 226.310 226.250 61240800.000 211.570 nan nan nan nan nan nan nan
2017-01-18 226.800 225.900 226.540 226.750 54793300.000 212.038 nan nan nan nan nan 1.510 0.007
2017-01-19 227.000 225.410 226.840 225.910 66608800.000 211.252 nan nan nan nan nan -0.670 -0.003
2017-01-20 227.310 225.970 226.700 226.740 129168600.000 212.028 nan nan nan nan nan 0.340 0.002
2017-01-23 226.810 225.270 226.740 226.150 75061600.000 211.477 nan -52.243 nan nan nan -1.060 -0.005
2017-01-24 228.080 226.270 226.400 227.600 95555300.000 212.833 nan 168.187 nan nan nan 1.140 0.005
2017-01-25 229.570 228.510 228.700 229.570 84437700.000 214.675 nan 321.968 nan nan nan 3.110 0.014
2017-01-26 229.710 229.010 229.400 229.330 59970700.000 214.450 nan 219.276 nan nan nan 2.230 0.010
2017-01-27 229.590 228.760 229.420 228.970 59711100.000 214.114 nan 142.345 nan nan nan 2.440 0.011
2017-01-30 228.200 226.410 228.170 227.550 79737300.000 212.786 nan 15.591 nan nan nan 0.500 0.002
2017-01-31 227.600 226.320 226.980 227.530 75880800.000 212.767 nan -4.022 229.254 227.069 224.884 1.280 0.006
2017-02-01 228.590 226.940 227.530 227.620 79117700.000 212.851 nan 31.568 229.148 227.121 225.095 0.870 0.004
2017-02-02 228.100 226.820 227.620 227.770 69657600.000 212.991 nan 13.427 229.205 227.183 225.162 1.860 0.008
2017-02-03 229.550 228.460 228.820 229.340 80563200.000 214.460 nan 107.690 229.564 227.389 225.213 2.600 0.011
2017-02-06 229.330 228.540 228.870 228.930 57790100.000 214.076 nan 79.407 229.809 227.535 225.262 2.780 0.012
2017-02-07 229.660 228.720 229.380 228.940 57931200.000 214.086 nan 75.763 229.977 227.669 225.362 1.340 0.006
2017-02-08 229.390 228.310 228.940 229.240 51566200.000 214.366 nan 57.571 230.168 227.819 225.469 -0.330 -0.001
2017-02-09 230.950 229.240 229.240 230.600 65955200.000 215.638 nan 124.763 230.719 228.084 225.448 1.270 0.006
2017-02-10 231.770 230.620 231.000 231.510 66015900.000 216.489 nan 179.751 231.392 228.410 225.428 2.540 0.011
2017-02-13 233.070 232.050 232.080 232.770 55182100.000 217.667 nan 229.724 232.368 228.825 225.282 5.220 0.023
2017-02-14 233.710 232.160 232.560 233.700 71109000.000 218.537 nan 181.148 233.355 229.290 225.224 6.170 0.027
2017-02-15 235.140 233.390 233.450 234.920 86785800.000 219.678 nan 169.285 234.562 229.826 225.090 7.300 0.032
2017-02-16 235.160 233.850 234.950 234.720 84722400.000 219.491 nan 133.359 235.338 230.292 225.246 6.950 0.031
2017-02-17 235.090 233.930 233.950 235.090 77204100.000 219.837 nan 111.905 236.125 230.749 225.373 5.750 0.025
2017-02-21 236.690 235.510 235.520 236.490 88946100.000 221.146 nan 128.435 237.033 231.296 225.559 7.560 0.033
2017-02-22 236.540 235.830 236.020 236.280 62115200.000 220.949 nan 108.323 237.835 231.770 225.706 7.340 0.032
2017-02-23 236.900 235.560 236.880 236.440 74615900.000 221.099 nan 98.019 238.672 232.215 225.758 7.200 0.031
2017-02-24 236.790 235.410 235.460 236.740 82381600.000 221.380 nan 86.951 239.431 232.646 225.861 6.140 0.027
2017-02-27 237.310 236.350 236.640 237.110 56515400.000 221.725 nan 92.456 240.110 233.071 226.032 5.600 0.024
2017-02-28 236.950 236.020 236.670 236.470 96961900.000 221.127 nan 73.549 240.337 233.395 226.452 3.700 0.016
2017-03-01 240.320 238.370 238.390 239.780 149158200.000 224.222 nan 158.568 241.201 234.003 226.805 6.080 0.026
2017-03-02 239.570 238.210 239.560 238.270 70246000.000 222.810 nan 118.986 241.445 234.409 227.374 3.350 0.014
2017-03-03 238.610 237.730 238.170 238.420 81974300.000 222.951 nan 97.847 241.540 234.791 228.042 3.700 0.016
2017-03-06 238.120 237.010 237.500 237.710 55391500.000 222.287 nan 62.714 241.573 235.069 228.566 2.620 0.011
2017-03-07 237.770 236.760 237.360 237.000 65103700.000 221.623 nan 28.956 241.255 235.253 229.251 0.510 0.002
2017-03-08 237.640 236.400 237.340 236.560 78168800.000 221.211 nan 1.441 240.692 235.378 230.063 0.280 0.001
2017-03-09 237.240 235.740 236.700 236.860 90683900.000 221.492 nan -28.072 240.016 235.519 231.021 0.420 0.002
2017-03-10 238.020 236.590 237.970 237.690 81991700.000 222.268 nan 20.872 239.576 235.726 231.875 0.950 0.004
2017-03-13 237.860 237.240 237.620 237.810 57256800.000 222.380 nan 30.353 239.162 235.924 232.686 0.700 0.003
2017-03-14 237.240 236.190 237.180 236.900 59880800.000 221.529 nan -49.697 238.754 236.017 233.280 0.430 0.002
2017-03-15 239.440 237.290 237.560 238.950 96081800.000 223.446 nan 94.220 238.812 236.296 233.781 -0.830 -0.003

In [ ]: