Notebook
In [55]:
import numpy as cal
import matplotlib.pyplot as plt
import pandas as pd
In [56]:
symbol = 'SPY'
price = get_pricing(symbol,fields = 'price', start_date= '2016-12-1', end_date= '2016-12-9',frequency = 'minute')
plt.plot(price)
Out[56]:
[<matplotlib.lines.Line2D at 0x7f75ffad3750>]
In [58]:
symbol = 'SPY'
price = get_pricing(symbol,fields = 'price', start_date= '2016-12-1', end_date= '2016-12-9',frequency = 'minute')
price.name = symbol
price = pd.DataFrame(price)
price['Date'] = price.index
price.index = range(0, len(price))
print price.head()
plt.plot(price[symbol])
       SPY                      Date
0  220.660 2016-12-01 14:31:00+00:00
1  220.563 2016-12-01 14:32:00+00:00
2  220.560 2016-12-01 14:33:00+00:00
3  220.440 2016-12-01 14:34:00+00:00
4  220.420 2016-12-01 14:35:00+00:00
Out[58]:
[<matplotlib.lines.Line2D at 0x7f7610132b50>]
In [62]:
s = pd.Series([2,3,2,3,2,3])
s.index = ['dog', 'cat','dog', 'cat','dog', 'cat']
In [63]:
s
Out[63]:
dog    2
cat    3
dog    2
cat    3
dog    2
cat    3
dtype: int64
In [67]:
s.plot()
Out[67]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f76100f9c90>
In [78]:
import datetime
price = get_pricing(symbol,fields = 'price', start_date= '2016-12-1', end_date= '2016-12-9',frequency = 'minute')
price.index = price.index.strftime("%Y-%m-%d %H:%M:%S")
#print datetime.datetime.strptime('January 11, 2010', '%B %d, %Y').strftime('%A')
price.index
Out[78]:
Index([u'2016-12-01 14:31:00', u'2016-12-01 14:32:00', u'2016-12-01 14:33:00',
       u'2016-12-01 14:34:00', u'2016-12-01 14:35:00', u'2016-12-01 14:36:00',
       u'2016-12-01 14:37:00', u'2016-12-01 14:38:00', u'2016-12-01 14:39:00',
       u'2016-12-01 14:40:00',
       ...
       u'2016-12-09 20:51:00', u'2016-12-09 20:52:00', u'2016-12-09 20:53:00',
       u'2016-12-09 20:54:00', u'2016-12-09 20:55:00', u'2016-12-09 20:56:00',
       u'2016-12-09 20:57:00', u'2016-12-09 20:58:00', u'2016-12-09 20:59:00',
       u'2016-12-09 21:00:00'],
      dtype='object', length=2730)
In [80]:
price.plot()
Out[80]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f75ff786ed0>
In [ ]: