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特定部分。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM