Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. ultra1971
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 11
    • Best 2
    • Controversial 0
    • Groups 0

    ultra1971

    @ultra1971

    3
    Reputation
    10
    Profile views
    11
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    ultra1971 Unfollow Follow

    Best posts made by ultra1971

    • A new IB integration using ib_insync

      Hey, guys!

      I really appreciate the support of this community and also the work of Daniel behind backtrader. I have extended and created my own framework based on backtrader, there is nothing like this out there.

      So your help is needed again, but in this case testing this version of the IB Store (Broker and DataFeed) using async integration with Interactive Brokers through ib_insync. I believe that this feature is one of the most recurrent improvement request for backtrader (and also a need for myself).

      The repo is here: https://github.com/ultra1971/backtrader_ib_insync

      Remember this an alpha+ version but fully working in my dev environment.

      During the stress testing that I ran with the tick price implementation, an average of 3 orders per second were reached, very promising. The connection stability is another improvement, this means no more hangs and this is something that you're looking for in any algotrading platform.

      You can find most of the original IB Store logic are there, cover most of the functionality, but happy to complete this with your support.

      A special thanks to the ib_insync community and of course to Ewald for keep this project active.

      Finally, this is the best way that I find to give you back my appreciation, thanks.

      Regards

      posted in General Code/Help
      ultra1971
      ultra1971
    • RE: How do I run different data feeds at different timeframes in live trading

      @hercp, at RTB 5sec level TWS api still deliver a OLHC bar.

      But the TWS api implementation under 5 sec deliver price based on tick data. The IBStore (based on IBPy2) pull tickers with tick code= 233 for non "CASH" symbols, take a look into function def reqMktData() and IBData feed take this and calculate a price usinf function def _load_rtvolume():

      The IB API tick type documentation is here:
      https://interactivebrokers.github.io/tws-api/tick_types.html

      posted in General Discussion
      ultra1971
      ultra1971

    Latest posts made by ultra1971

    • RE: trades not registering, but strategy is plotting

      Pls include some data to check if you have enough cash to buy,

      Try changing initial cash, set up a size in the buy function and define a notify_trade method (lot of examples just google) .

      The crossover analyzer is working so if the buy fuction is executed then order is rejected for any reason.

      posted in General Code/Help
      ultra1971
      ultra1971
    • RE: using backtrader with pandas

      @dizzy0ny nop, you need to use data feed.

      backtrader is a event-based backtesting, and based on yur short description you are using a vector based backtesting.

      The second one mode is faster, the first one is more accurate, and you need to transform the logic from one method to another.

      The use of talib is allow into the platform with data feed, so the process will be easy, laborious but easy.

      posted in General Discussion
      ultra1971
      ultra1971
    • RE: Formatting of output csv from bt.Writer

      @damag00 all the analyzers data are return to you as part of any cerebro run, then you can get this dict a put it into a df, csv, or any data structure.

      Take a look of this:
      https://www.backtrader.com/docu/analyzers/analyzers/#a-quick-example

      In this case, thestrat variable collects all the analyzers info captured during the cerebro execution.
      So you need to choose the right analyzer to collect the most valuables metrics and post processing for your own.

      posted in General Code/Help
      ultra1971
      ultra1971
    • RE: A new IB integration using ib_sync

      @ultra1971 thanks to @dasch i can use
      pip install git+https://github.com/ultra1971/backtrader_ib_insync

      as a installation method

      posted in General Discussion
      ultra1971
      ultra1971
    • RE: A new IB integration using ib_sync

      @dasch I just started to use github, and need to learn how to use the platform. Thanks for your contribution!

      I intentionally keep the names in order to make a full replacement to the legacy IBStore, and also reduce the changes into current code, but open to your feedback, guys

      posted in General Discussion
      ultra1971
      ultra1971
    • RE: A new IB integration using ib_sync

      @run-out yes, no problem, and also I will include a simple mockup as an example of how to use.

      But I suggest to create a folder into your own project and put all the files there, including "_ _ init_ _.py"

      That part of the code that you get the error is very tricky, take me a lot of debug time understand the issue and how to solve.

      posted in General Discussion
      ultra1971
      ultra1971
    • RE: A new IB integration using ib_sync

      @run-out yes, know the error very well, pls put also init.py into the folder to import everything.

      The IDStore calls to the IBBoker.BrokerCls attribute but is not set not at this time. You can force this setting it manually pointing the location of the IBBroker, but is not the idea.

      posted in General Discussion
      ultra1971
      ultra1971
    • RE: How do I run different data feeds at different timeframes in live trading

      @hercp, at RTB 5sec level TWS api still deliver a OLHC bar.

      But the TWS api implementation under 5 sec deliver price based on tick data. The IBStore (based on IBPy2) pull tickers with tick code= 233 for non "CASH" symbols, take a look into function def reqMktData() and IBData feed take this and calculate a price usinf function def _load_rtvolume():

      The IB API tick type documentation is here:
      https://interactivebrokers.github.io/tws-api/tick_types.html

      posted in General Discussion
      ultra1971
      ultra1971
    • RE: A new IB integration using ib_insync

      @vladisld thanks, only smoke tests were performed, a more complete automated testing would be great.

      Taking in mind that my goal was replace IBpy by ib_insync, my concerns are more related to order and position sync between IB and backtrader, into the new broker class.

      The new Store implements the async use of ib_insync, i.e. all connectivity control with IB rely on the new api lib

      The new data feed also take benefit of this, realtime bars (5s) are working really good, but also I have implemented price base tick if rtb=False.
      It's important to avoid the IB requirements for hist data submitting several request in a short period of time. (https://interactivebrokers.github.io/tws-api/historical_limitations.html#pacing_violations).

      posted in General Code/Help
      ultra1971
      ultra1971
    • A new IB integration using ib_insync

      Hey, guys!

      I really appreciate the support of this community and also the work of Daniel behind backtrader. I have extended and created my own framework based on backtrader, there is nothing like this out there.

      So your help is needed again, but in this case testing this version of the IB Store (Broker and DataFeed) using async integration with Interactive Brokers through ib_insync. I believe that this feature is one of the most recurrent improvement request for backtrader (and also a need for myself).

      The repo is here: https://github.com/ultra1971/backtrader_ib_insync

      Remember this an alpha+ version but fully working in my dev environment.

      During the stress testing that I ran with the tick price implementation, an average of 3 orders per second were reached, very promising. The connection stability is another improvement, this means no more hangs and this is something that you're looking for in any algotrading platform.

      You can find most of the original IB Store logic are there, cover most of the functionality, but happy to complete this with your support.

      A special thanks to the ib_insync community and of course to Ewald for keep this project active.

      Finally, this is the best way that I find to give you back my appreciation, thanks.

      Regards

      posted in General Code/Help
      ultra1971
      ultra1971