实盘的策略直接跑回测,即实盘和回测的策略都写在on_tick里,请问怎么弄?
实盘的策略直接跑回测,即实盘和回测的策略都写在on_tick里,请问怎么弄?
把策略逻辑写在on_tick里即可
回测的时候interval选择TICK即可
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
如果只基于on_tick交易,需要用jupyter回测
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