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/

    backtrader connects to diferent instance of TWS

    General Code/Help
    2
    6
    92
    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.
    • P
      Peixoto last edited by

      hello, I got my algo ready for final phase of tests, running non stop in a paper account in TWS for final validation.

      Now I am having an issue, so I open TWS and log into a paper account, I run my algo, my algo does some trades, I can see them happening with logs in my python script, but I don't see them appearing in the TWS window.
      I believe the tws window and my algo are running too different instances, is there any way to fix this, so when my algo does a trade I see it appear in TWS?

      I need this in case of some failure of my algo mid trade, I can manually close the trade and restart my algo.

      Best regards

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

        @peixoto said in backtrader connects to diferent instance of TWS:

        I believe the tws window and my algo are running too different instances

        Do you see any changes (like cash changes) in the portfolio window upon order execution?

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

          @vladisld no, nothing changes the cash amount, the trade tab and orders tab continues empty. sending here my connection part of my code

          store = backtrader.stores.IBStore( port=7497, host='127.0.0.1', clientId=35)

          and my tws settings
          0c63328c-c5c1-4633-8490-12ffb91f58f0-image.png

          any idea on why I am having this behavior?

          thanks in advance

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

            @peixoto The config looks ok. Could you try to pass None for clientId ( that's what I'm using in my system)?

            1 Reply Last reply Reply Quote 0
            • P
              Peixoto last edited by

              @vladisld said in backtrader connects to diferent instance of TWS:

              try to pass None for clientId ( that's what I'm using i

              I tried to pass None, same result, and after also set the Master API client ID to empty, still the same behaviour. any more sugestion?

              Thanks in advance

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

                @peixoto hmm, other than looking at the TWS API Log file and see if any order request came through I can't think of anything right now.

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