簡體   English   中英

我找不到我的語法錯誤:Python

[英]I can't find my syntax error: Python

我找不到應該在第一行的語法錯誤

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))

您基本上沒有在函數內添加任何選項卡。 這是正確的代碼:

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))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM