我无法找到语法错​​误:Python

时间:2016-02-06 22:53:40

标签: python syntax-error

我无法找到我的语法错误,这可能是在第一行

def before_trading_start(context, data):                             

context.output = pipeline_output('example')

#make a list based on highest trend value 
context.trend_list = context.output.sort(['ema_rank1'], ascending=True).iloc[:200]

#make a list based on highest price value
context.price_list = context.output.sort(['ema_rank2'], ascending =True).iloc[:200]


# Update your universe with the SIDs of long and short securities
update_universe(context.price_list.index.union(context.trend_list.index))

1 个答案:

答案 0 :(得分:0)

您基本上没有在函数内添加任何选项卡。这是正确的代码:

def before_trading_start(context, data):

    context.output = pipeline_output('example')

#make a list based on highest trend value
    context.trend_list = context.output.sort(['ema_rank1'], ascending=True).iloc[:200]

#make a list based on highest price value
    context.price_list = context.output.sort(['ema_rank2'], ascending =True).iloc[:200]


# Update your universe with the SIDs of long and short securities
    update_universe(context.price_list.index.union(context.trend_list.index))