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/

    Does 'preload' have to be set as 'False' while bt running in live-trading mode?

    General Discussion
    2
    5
    1593
    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.
    • K
      kev last edited by

      What are the merits for one another: 'preload' and not 'preload'?

      And does 'preload' have to be set as 'False' if we want bt to run in live-trading mode?

      1 Reply Last reply Reply Quote 0
      • P
        Paska Houso last edited by Paska Houso

        You cannot have both live trading and data preloading, because the data isn't there yet to be preloaded.

        A quick google query took to the Cerebro documentation: https://www.backtrader.com/docu/cerebro.html

        From the top of the reference of the class:

        preload (default: True)
        
        Whether to preload the different data feeds passed to cerebro for the Strategies
        
        runonce (default: True)
        
        Run Indicators in vectorized mode to speed up the entire system. Strategies and Observers will always be run on an event based basis
        
        live (default: False)
        
        If no data has reported itself as live (via the data’s islive method but the end user still want to run in live mode, this parameter can be set to true
        
        This will simultaneously deactivate preload and runonce. It will have no effect on memory saving schemes.
        
        Run Indicators in vectorized mode to speed up the entire system. Strategies and Observers will always be run on an event based basis
        
        K 1 Reply Last reply Reply Quote 0
        • K
          kev @Paska Houso last edited by

          @Paska-Houso Many thanks! I'm still at sea with the internals of backtrader, does it provide a method to get our current holdings (i.e. a list containing all the stocks we are now holding) ?

          1 Reply Last reply Reply Quote 0
          • P
            Paska Houso last edited by

            Not to by knowledge. But you have self.datas and self.getposition(data=None)

            A simple comprehension should do it:

            d_with_pos = [d for d in self.datas if self.getposition(d)]
            
            P 1 Reply Last reply Reply Quote 0
            • P
              Paska Houso @Paska Houso last edited by

              @Paska-Houso said in Does 'preload' have to be set as 'False' while bt running in live-trading mode?:

              Not to by knowledge. But you have self.datas and self.getposition

              A simple comprehension should do it:

              d_with_pos = [d for d in self.datas if self.getposition(d)]
              

              From the docs: https://www.backtrader.com/docu/strategy.html

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