2.1 Cerebro

2020-04-19  本文已影响0人  wanggs66

Cerebro 是BackTrader的核心,将各个元素聚集到一起,执行回测,返回结果,并提供可视化界面

Gathering input

Execute the backtesting

Returning the results

Giving access to the plotting facilities

Backtesting logic

  1. Deliver any store notifications
  2. Ask data feeds to deliver the next set of ticks/bars (第一个载入的数据为主数据,其他数据项主数据看齐)
  3. Notify the strategy about queued broker notifications of orders, trades and cash/value
  4. Tell the broker to accept queued orders and execute the pending orders with the new data
  5. Call the strategies’ next method to let the strategy evaluate the new data (and maybe issue orders which are queued in the broker)(同步执行observers,indicators, analyzers中的相关操作)
  6. Tell any writers to write the data to its target
    注意: 订单的执行在x+1时刻没因为x时刻产生相关交易信号和下单时,相关的市场状态已经成为历史。
上一篇下一篇

猜你喜欢

热点阅读