Backtrader中文笔记之Live Data/Live Trading(未完成,看不懂了)

原文链接:https://backtrader.com/blog/posts/2016-06-21-livedata-feed/live-data-feed/

Starting with release 1.5.0, backtrader supports Live Data Feeds and Live Trading. The first integrated entity is:

从1.5.0版开始,backtrader支持实时数据源和实时交易。第一个集成实体是:

  • Interactive Brokers
  • 互动经纪人

This was long sought goal since the inception of the platform as a small idea. The design ideas have proven to be flexible enough to accommodate the needed changes. All whilst keeping the same interface which means: backtest once, trade many times. The same code/api/primitives/notifications are meant for backtesting and live data feeding/trading.

这是自平台成立以来一直追求的目标。设计思想已经被证明是足够灵活的,以适应所需的变化。同时保持所有的接口相同,这意味着:一次回溯测试,多次交易。相同的代码/api/primitives/notifications用于回溯测试和实时数据馈送/交易。

Naming the platform back + trader was intentional, although it could have well been that it had remained as a pure backtester. But no longer.

将平台命名为back+trader是有意为之的,尽管很可能它仍然是一个纯粹的backtester。但不再是了。

What’s new changed:

有什么新变化

  • Store concept to have a integrated concept for entities like Interactive Brokers which provide data and brokering facilities in one go

  • Store概念为实体提供了集成的概念,如一次性提供数据和代理功能的交互式代理
  • New notifications to the strategy and/or cerebro from the store and/or data feeds

  • 来自商店和/或数据源向策略 和/或 大脑发出的新通知
  • Time management support … as one could be trading New York baed products from anywhere else and time has to be kept consistent

  • 时间管理支持   因为你可以从任何地方交易纽约baed产品,时间必须保持一致
  • Work on Resampling/Replaying to deliver bars as soon as possible or not too late if the market is not trading (nobody wants a 5 second resampled bar received 30 seconds later, because there were no intervening ticks)

  • 重新取样/重放,以尽快交付bar,如果市场没有交易,则不要太晚(没有人希望在30秒后收到5秒重采样bar,因为没有中间的ticks)
  • Of course many small internal changes

  • 当然还有许多内部的小变化

A great deal of testing has gone into the integration and a large sample called ibtest is integrated in the sources, but being this the 1st release there could still be some edges. Should you decide to give this a try, execute 1st against Paper Trading account provided by Interactive Brokers (usually running at port 7497 rather than 7496)

集成中已经进行了大量的测试,源代码中集成了一个名为ibtest的大型示例,但是作为第一个发布版,仍然有一些优势。如果您决定尝试一下,请对交互式经纪人提供的纸质交易帐户执行第一个命令(通常在7497端口而不是7496端口运行)

Note

Be sure to be comfortable with the inherent risks associated with data disconnection, bugs present in the software (TWS and backtrader), bugs in your own software and monitor your activities.

一定要熟悉与数据断开相关的固有风险、软件中存在的错误(TWS和backtrader)、您自己的软件中的错误并监视您的活动。

backtrader cannot take any responsibility or be held responsible for any losses a trader may incur (it will also not take any of the winnings)

backtrader不能承担任何责任,也不能对交易者可能遭受的任何损失负责(它也不会接受任何赢款)

What’s supported from Interactive Brokers:

交互式代理支持的内容

  • Indices (obviously not for trading), Stocks, Futures, Options, Futures Options and Forex

  • 指数(显然不用于交易)、股票、期货、期权、期货期权和外汇
  • Backfilling at the start of a connection and after a reconnection

  • 连接开始时和重新连接后回填
  • Notifications on change from live to backfilling and viceversa

  • 从直播到回填的变化通知
  • The order types already existing in backtrader: Market, Limit, StopLimit and Close (aka Market on Close*)

  • backtrader中已经存在的订单类型:Market、Limit、stop Limit和Close(aka Market on Close*)

It is not the intention of the platform to reinvent the wheel, so the following is needed/optional to use the Interactive Brokers facilities:

平台并不打算重新设计轮子,因此需要/可选使用交互式代理工具:

  • Required: IbPy to interface with Interative Brokers’ TWS

  • 必需:IbPy与Interactive Brokers的TW接口

    The documentation for IB indicates how to install it if not already part of your arsenal

  • IB的文档说明了如何安装它,如果它还不是您的工具库的一部分
  • Optional: pytz to automatically set the timezone for the products.

  • 可选:pytz自动设置产品的时区。
  • The end-user may provide other tzinfo -compatible instances (from pytz or home-cooked) directly as a parameter to the data source rather than relying on automatic determination. See Time Management in the docs and the IB specific part of the documents.

  • 最终用户可以直接向数据源提供其他与tzinfo兼容的实例(来自pytz或home-cooked),而不是依赖于自动确定。参见文件中的时间管理和文件的IB特定部分。
原文地址:https://www.cnblogs.com/sidianok/p/13725080.html