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/

    Load existing orders from broker

    General Code/Help
    3
    5
    319
    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.
    • Thiago P.
      Thiago P. last edited by

      Does backtrader have the ability to load existing orders from a live broker account?

      For example, I place some orders with backtrader and the program shuts down. When the program starts up again, I'd like to be able to resume where I left off.

      I've looked around the docs, forum, and web in general and could not find anything pertaining to this.

      Thanks

      Thiago P. 1 Reply Last reply Reply Quote 0
      • Thiago P.
        Thiago P. @Thiago P. last edited by

        @Thiago-P
        To be more specific, load pending buy and sell orders and currently held positions from the broker?

        1 Reply Last reply Reply Quote 0
        • vladisld
          vladisld last edited by

          I think this question was already answered few times. Please take a look:
          Is there way to track open orders with IB broker?
          Is it possible to retrieve all the open/active orders from Interactive Broker?
          Ways to repopulate IB trades/orders in strategy after shutdown

          You may probably find other similar questions & answers by searching for 'open orders'.

          1 Reply Last reply Reply Quote 1
          • Thiago P.
            Thiago P. last edited by

            From what I've gathered the answer is, "It depends on the broker you're using"

            What I've discovered

            It looks like the default back trader broker provides a get_orders_open method and it seems like the IB broker provides something of the sort as well, though I'm not sure if these will fetch orders already existing with the broker.

            My intention was to use Alpaca as my broker through alpaca-backtrader-api. After experimentation using alpaca paper trading and looking through the alpaca-backtrader-api source code, it seems that the Alpaca broker does not provided any such method.

            Conclusion

            If I wanted to get existing Alpaca orders I'd have to make an API call directly to Alpaca or spend my time extending the Alpaca backtrader API.

            Thanks for the links @vladisld

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

              Indeed. Each broker implementation is responsible for such an action.

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