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/

    IB and get_orders_open

    General Code/Help
    3
    3
    920
    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.
    • A
      algoguy235 last edited by algoguy235

      Is there a way to pull in open orders from IB?

      If I enter an order to IB and then my program crashes, when I reconnect, the order is still sitting in my IB orderbook, but no orders available in the software via self.order. This leaves me powerless to cancel the order via software.

      self.broker does not seem to have get_orders_open() method available.

      Is it possible?

      (Pdb) [print(func) for func in dir(self.broker) if not func.startswith('_')]
      BrokerBase
      CANCELLED
      FILLED
      IBBroker
      INACTIVE
      PENDINGCANCEL
      PENDINGSUBMIT
      PRESUBMITTED
      SUBMITTED
      add_order_history
      addcommissioninfo
      buy
      cancel
      cash
      cerebro
      comminfo
      executions
      frompackages
      fundmode
      fundshares
      fundvalue
      get_fundmode
      get_fundshares
      get_fundvalue
      get_notification
      getcash
      getcommissioninfo
      getposition
      getvalue
      ib
      init
      next
      notifs
      notify
      orderbyid
      orderstatus
      ordstatus
      p
      packages
      params
      push_commissionreport
      push_execution
      push_ordererror
      push_orderstate
      push_orderstatus
      push_portupdate
      sell
      set_fund_history
      set_fundmode
      setcommission
      start
      startingcash
      startingvalue
      stop
      submit
      tonotify
      value
      
      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        No, there isn't. backtrader isn't conceived as a manager of your account. You could keep the IB reference of orders you have created in your preferred form of storage and check it against the incoming order to discard it if needed.

        You probably want to check/store these two fields:

        • m_clientId: which client created the order (you may have other clients connecting to the API)
        • m_permId: the host order identifier
        1 Reply Last reply Reply Quote 0
        • Z
          z_kvn last edited by

          @backtrader Would you consider adding such an API method in the future? This would be very useful feature for live trading.

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