![](/img/trans.png)
[英]unknown syntax error in python (I really can't find out where is my error)
[英]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.