@Casey Maynard
Notebook:
get_pricing('COHR',start_date='2016-10-17', end_date='2016-10-17')
Algorithm:
def initialize(context):
pass
def handle_data(context, data):
context_hist = data.history(sid(1751), ['price', 'volume'], 10, '1d')
context_nine_day = context_hist[:-9]
print context_nine_day
@Jerry Xu
Notebook:
vwap_hist = get_pricing('COHR', start_date='2016-10-17', end_date='2016-10-22', fields = ['price', 'volume'])
vwap_3 = (vwap_hist['price'][:-3] * vwap_hist['volume'][:-3]).sum() / vwap_hist['volume'][:-3].sum()
vwap_5 = (vwap_hist['price'] * vwap_hist['volume']).sum() / vwap_hist['volume'].sum()
print "3 day VWAP"
print vwap_3
print "5 day VWAP"
print vwap_5
Algorithm:
def initialize(context):
pass
def handle_data(context, data):
vwap_hist = data.history(sid(1751), ['price', 'volume'], 10, '1d')[:-5]
vwap_3 = (vwap_hist['price'][:-3] * vwap_hist['volume'][:-3]).sum() / vwap_hist['volume'][:-3].sum()
vwap_5 = (vwap_hist['price'] * vwap_hist['volume']).sum() / vwap_hist['volume'].sum()
print ("3 day VWAP: ")
print vwap_3
print ("5 day VWAP: ")
print vwap_5