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/

    Can get live data from IB but can't trade or get position

    General Code/Help
    2
    2
    21
    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
      adrianyuen last edited by

      By referencing the sample code ibtest.py, I can get live data from IB. However, I try to place a buy order throught the paper account, but can't make the trade successfully. I also can't get the position.

      I got the following order information. It's ordered with market price. However, I tried other limited price order but failed as well. Could anyone give me some hints/suggestions? Thank you.


      -------------------------------------------------- ORDER BEGIN 2021-02-10 23:15:15.729882
      Ref: 28
      OrdType: 0
      OrdType: Buy
      Status: 1
      Status: Submitted
      Size: 1
      Price: None
      Price Limit: None
      TrailAmount: None
      TrailPercent: None
      ExecType: 0
      ExecType: Market
      CommInfo: None
      End of Session: 737831.6666666665
      Info: AutoOrderedDict()
      Broker: None
      Alive: True
      -------------------------------------------------- ORDER END
      -------------------------------------------------- ORDER BEGIN 2021-02-10 23:15:15.732300
      Ref: 28
      OrdType: 0
      OrdType: Buy
      Status: 7
      Status: Margin
      Size: 1
      Price: None
      Price Limit: None
      TrailAmount: None
      TrailPercent: None
      ExecType: 0
      ExecType: Market
      CommInfo: None
      End of Session: 737831.6666666665
      Info: AutoOrderedDict()
      Broker: None
      Alive: False
      -------------------------------------------------- ORDER END

      E 1 Reply Last reply Reply Quote 0
      • E
        EMR @adrianyuen last edited by

        @adrianyuen Seems there is a margin issue : "Status: Margin"
        See :
        https://www.backtrader.com/docu/order/#order-status-values

        Do you have enough cash on the paper account ?
        Do you use the store model (https://www.backtrader.com/docu/live/ib/ib/)

        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(); }); }