VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 46
声望: 0

实盘的策略直接跑回测,即实盘和回测的策略都写在on_tick里,请问怎么弄?

Member
avatar
加入于:
帖子: 5005
声望: 302

把策略逻辑写在on_tick里即可
回测的时候interval选择TICK即可

Member
avatar
加入于:
帖子: 46
声望: 0

xiaohe wrote:

把策略逻辑写在on_tick里即可
回测的时候interval选择TICK即可

tick回测没有交易且出现下面错误:
Traceback (most recent call last):
File "C:\veighna_studio\lib\site-packages\vnpy_ctabacktester\ui\widget.py", line 387, in process_backtesting_finished_event
self.show_candle_chart()
File "C:\veighna_studio\lib\site-packages\vnpy_ctabacktester\ui\widget.py", line 809, in show_candle_chart
self.candle_dialog.update_history(history)
File "C:\veighna_studio\lib\site-packages\vnpy_ctabacktester\ui\widget.py", line 2194, in update_history
self.chart.update_history(history)
File "C:\veighna_studio\lib\site-packages\vnpy\chart\widget.py", line 177, in update_history
self.move_to_right()
File "C:\veighna_studio\lib\site-packages\vnpy\chart\widget.py", line 352, in move_to_right
self._cursor.update_info()
File "C:\veighna_studio\lib\site-packages\vnpy\chart\widget.py", line 563, in update_info
item_info_text: str = item.get_info_text(self._x)
File "C:\veighna_studio\lib\site-packages\vnpy\chart\item.py", line 264, in get_info_text
for t in bar.trades:
AttributeError: 'TickData' object has no attribute 'trades

Member
avatar
加入于:
帖子: 46
声望: 0

xiaohe wrote:

把策略逻辑写在on_tick里即可
回测的时候interval选择TICK即可

走的还是on_bar里的策略

Member
avatar
加入于:
帖子: 5005
声望: 302

如果只基于on_tick交易,需要用jupyter回测

Member
avatar
加入于:
帖子: 46
声望: 0

xiaohe wrote:

如果只基于on_tick交易,需要用jupyter回测

jupyter回测是什么?

Member
avatar
加入于:
帖子: 126
声望: 4

https://github.com/vnpy/vnpy/blob/master/examples/cta_backtesting/backtesting_demo.ipynb
曲18596122723 wrote:

xiaohe wrote:

如果只基于on_tick交易,需要用jupyter回测

jupyter回测是什么?
https://github.com/vnpy/vnpy/blob/master/examples/cta_backtesting/backtesting_demo.ipynb

© 2015-2022 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】