Hello,
I am new to using python and zipline and am trying to get stock data using the data.history function but am getting a NameError for some reason I cannot figure out. I am sure I missed some step somewhere and would appreciate any help to on how to solve this. Here is the code snippet I am using:
from zipline import run_algorithm
from zipline.api import order_target_percent, symbol
def initialize(context):
context.stock = symbol('AAPL')
context.index_average_window = 100
def handle_data(context,data):
equities_hist = data.history(context.stock, "close",
context.index_average_window,"1d")
equities_hist
When I run 'equities_hist' I get the message: "NameError: name 'equities_hist' is not defined".
Appreciate any guidance on what I'm doing wrong.
Thanks!