# make a list of the securities one wishes to get pricing for
my_securities = symbols(['AAPL'])
# set the start and stop date-time.
# note that times/dates are specified in UTC
start_date = '2016-12-10'
end_date = '2017-12-10'
# run the get_pricing method to pull in actual data
# the result is a Pandas dataframe
my_prices = get_pricing(symbols=my_securities,
start_date=start_date,
end_date=end_date,
frequency='daily',
fields=['close_price'])
# display the resulting dataframe
my_prices.close_price
# Ue the 'rolling' method along with 'mean' to get a rolling average
# Set the window length to whatever is desired. In this case a window of 20 days
my_average_prices = my_prices.close_price.rolling(20).mean()
my_average_prices
# Now one can easily plot the rolling average along with the actual close prices
ax = my_prices.close_price.plot()
my_average_prices.plot(ax=ax)