Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Getting Bid/Ask along with ohlc in next()

    General Code/Help
    2
    3
    1386
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      skytrading54 last edited by

      Hi All,
      As per the backtrader framework out strategies order would be triggered from strategies next call which gets called as my be set up based on timeframe/compression and resampling/replaying.

      While this is okay for backtesting for real life orders I am trying to get top bid and ask price as well into the next(), however it would not be a line. These would be two standalone float keeping the latest values.

      This should happen irrespective of --rtbar enabled or not which means real time data should always be subscribed and it will keep on updating bid and ask as received and whenever next is called we need to be able to reference these variables in next.

      uses: to be used to decide the limit prices for orders. Also would be would be used to see if market is trading in extreme conditions (when the spread of bid ask increases drastically compared).

      I am looking to implement this from IB perspective.

      Could you please help what would be optimal way to do this with pointers as to which class should own these variables and how to make it available in next.

      Thanks in advance.

      1 Reply Last reply Reply Quote 0
      • S
        skytrading54 last edited by

        could anyone point me if store can be assessed from strategies next() call.

        1 Reply Last reply Reply Quote 0
        • B
          backtrader administrators last edited by

          It was not meant so, but there are 2 options:

          1 Generic

          • You pass the created store as an argument to your strategy

          2 IBData specific

          • It has an attribute named ib which is the *store. You can then do: self.data0.ib.xxxxx for example
          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
          $(document).ready(function () { app.coldLoad(); }); }