问答交流

“回测中滑点应用失败‘’

由bq8ispcb创建,最终由small_q 被浏览 10 用户

交易引擎:初始化函数,只执行一次

def bigquant_run(context):

context.set_commission(PerOrder(buy_cost=0.0001, sell_cost=0.0011, min_cost=0))
context.slippage.VolumeShareSlippage(volume_limit=0.025, price_impact=0.1)

#读取数据
context.ranker_prediction = context.options['data'].read_df()
context.ranker_prediction.set_index('date',inplace=True)

#print(context.ranker_prediction)

报错

30 def m6_initialize_bigquant_run(context): 32 context.set_commission(PerOrder(buy_cost=0.0001, sell_cost=0.0011, min_cost=0)) ---> 33 context.slippage.VolumeShareSlippage(volume_limit=0.025, price_impact=0.1) 36 #读取数据 37 context.ranker_prediction = context.options['data'].read_df() AttributeError: 'StrategyContext' object has no attribute 'slippage'


按照

https://bigquant.com/wiki/doc/5bi455so6k6572u-duEk1kveDh#h-setslippage

中的各种滑点方法都试了下,都不行,是只有特定模块的trade模块才可以用滑点吗,还是bigquant回测不支持滑点呢

标签

回测交易引擎
评论
  • context.set_slippage(bar_slippage=FixedBasisPointsSlippage(basis_points=5, volume_limit=0.1)) 试下这个方法呢?
  • 显示name 'FixedBasisPointsSlippage' is not defined,算了,我在手续费里多加点吧
  • https://bigquant.com/codeshare/75764052-f35d-4e0b-89fd-86a979038e29