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/

    Broker: Stop Getting Cash and Value During Backfill

    General Code/Help
    2
    4
    586
    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.
    • T
      ThatBlokeDave last edited by

      Hello All

      Is there way to prevent the broker from attempting to call getcash() and getvalue() during a backfill? I.e when self._state = self._ST_HISTORBACK ?

      I guess this might be an illogical thing to ask since we can have multiple feeds and some might be delayed, reconnecting backfilling etc whilst others are live....

      The reason I am asking is because I have been playing around with the CCXT implementation from Mr Bartosh and noticed that Backfilling takes a long time as a rest API call is made to access cash and value before the bar comes in and after.

      So I am trying to think of a way to speed things up a little.

      Cheers!

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

        The thing is that the internals don't know if you are backfilling or not and go through the entire cycle. The key to support different modes transparently is to not make distinctions as to what the actual nature of the data is.

        T 1 Reply Last reply Reply Quote 0
        • T
          ThatBlokeDave @backtrader last edited by

          @backtrader

          Sure, I appreciate that thanks.

          So in the end I decided to do something a bit hacky and add a attribute to the CCXT broker that can be overwritten from inside the strategy. I.e When I set it to false, the broker will just return the last cash and value figures that were downloaded. If it is true the broker will make the proper store method call.

          Probably not the best idea but needs must :) I can now warm up the indicators without waiting a lifetime.

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

            This was discussed in another thread: the broker should not make synchronous calls ...

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors