Hello Everybody,
I am working on a very simple algorithm and I only want it to live trade once per day right before closing (like a daily backtest works) (I may want to make the trades at the beginning of the day depending on the results). I want to do this because the funds are leveraged ETFs so I lose money if I trade more than once per day. The only problem is that I don't know what I am doing wrong with the schedule_function. I keep getting the error: Line 4: Error: SyntaxError: pass the non-keyword argument before the keyword argument.
Here is the code:
def initialize(context):
context.stocks = [sid(32272), sid(39214), sid(32269), sid(39215), sid(32270), sid(38533), sid(32271), sid(39216), sid(33209), sid(33208), sid(39217), sid(38564)]
schedule_function(func=handle_data, date_rules.every_day(), time_rules.market_close(hours=0, minutes=1), half_days=True)
def handle_data(context, data):
for stock in context.stocks:
if stock in data:
order_target_percent(stock,0.08333333333)
Thanks for all of the help,
Nick V