I wanted to ask if any could give me quick support on coding issue. I noticed that the whole algo stalls when there is nothing to return on
context.output = pipeline_output('ranked_2000')
I would like the "before_trading_start" to return nothing using the typical exception handling mechanism. Could you please modify the code below so that it would accomplish what I am trying to do? I am very novice programmer and did everything in my work life in Excel (basically learned the logic, but don't know how to program well).
def before_trading_start(context, data):
try:
context.output = pipeline_output('ranked_2000')
except:
continue
ranked_2000 = context.output.fillna(0)
log.info("\n" + str(len(context.output)))
context.len_long_short = min(len(ranked_2000), 30)
context.long_list = ranked_2000.sort(['combo_rank'], ascending=False).iloc[:context.len_long_short]
#context.long_list = ranked_2000.sort(['testFactor'], ascending=True).iloc[:context.len_long_short]
context.short_list = ranked_2000.sort(['combo_rank'], ascending=False).iloc[-0:]
update_universe(context.long_list.index.union(context.short_list.index))
print 'open orders'
print get_open_orders()