Hi all,
I'm new to Quantopian, and I'm trying some examples from the Cookbook. I got this error in the following example.
I would like to know why this error occurs.
I would greatly appreciate any help to clarify this.
def initialize(context):
schedule_function(
my_func,
date_rules.every_day(),
time_rules.market_open(minutes=15)
)
def my_func(context, data):
# Order 100 shares of AAPL.
order_target(sid(24), 100)
# Retrieve all open orders.
open_orders = get_open_orders()
# If there are any open orders.
if open_orders:
# open_orders is a dictionary keyed by sid, with values that are lists of orders. Iterate over the dictionary
for security, orders in open_orders.iteritems():
# Iterate over the orders and log the total open amount
# for each order.
for oo in orders:
message = 'Open order for {amount} shares in {stock}'
message = message.format(amount=oo.amount, stock=security)
log.info(message)