Hello there! I am just start learning python and the following message is shown up regarding my line 31,
" Passing non-Asset argument to 'order()' is not supported. Use 'sid()' or 'symbol()' methods to look up an Asset.There was a runtime error on line 31"
Here is my code:
def initialize(context):
context.future = continuous_future('YM', offset=0, roll='volume', adjustment='mul')
total_minutes = 10*60
for i in range (1, total_minutes):
if i % 8 == 0:
schedule_function(func=check,
date_rule=date_rules.every_day(),
time_rule=time_rules.market_open(minutes=i),
calendar =calendars.US_FUTURES)
def check (context, data):
candle_close = data.current(context.future, 'close')
if candle_close < a and candle_close > b:
order_target(context.future, -2) <-- Line 31
I wonder if there is a way to trade futures in terms of the number of contracts at quantopian. Thanks you !!!!