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/

    Is anyone failed to use ibpy in new TWS on windows?

    General Code/Help
    2
    5
    117
    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.
    • tianjixuetu
      tianjixuetu last edited by

      I use TWS and IBpy on ubuntu,it's ok. However,on the windows10,the IBpy cannot connect to TWS.
      error info:

      <error id=-1, errorCode=502, errorMsg=Couldn't connect to TWS.  Confirm that "Enable ActiveX and Socket Clients" is enabled on the TWS "Configure->API" menu.>
      

      ![alt text](1e11420e-3006-4d35-813e-564bb355cd2b-image.png image url)

      from ib.opt import Connection
      
      def print_message_from_ib(msg):
          print(msg)
          
      def main():
          conn = Connection.create(host="127.0.0.1",port="7497",clientId=999)
          conn.registerAll(print_message_from_ib)
          conn.connect()
          
          #In future blog posts, this is where we'll write code that actually does
          #something useful, like place orders, get real-time prices, etc.
          
          import time
          time.sleep(1) #Simply to give the program time to print messages sent from IB
          conn.disconnect()
          
      if __name__ == "__main__": main()
      
      vladisld 1 Reply Last reply Reply Quote 0
      • vladisld
        vladisld @tianjixuetu last edited by

        @tianjixuetu As the error said - you should check the "Enable ActiveX and Socket Clients" settings

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

          @vladisld I am very sorry. this picture is new, in fact, in the TWS, the "Enable ActiveX and Socket Clients" is choosed. however,when I use the TWS API ,not the IBpy,I can connect. so,is the IBpy on the windows go wrong? on the ubuntu,the IBpy can use.

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

            @tianjixuetu ok. One other thing that I've noticed in my experience is the default port number on linux and windows could be different.

            So if your code assumes the same port on all platforms - this could be a source of the problem and it worth to check this out.

            I

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

              @vladisld thank you very much.

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