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 realtimeBar subscription stops during the trading session due to bust events

    General Code/Help
    3
    13
    524
    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.
    • vladisld
      vladisld last edited by

      Please see my post in "TWS API Users Group": https://groups.io/g/twsapi/topic/69943076

      Up to the TWS API v972, IB realtimeBar subscriptions could stop working during the trading session and no error notification was sent to the application. This happens because of what's called 'busts' events.

      Quoting the response in "TWS API Users Group" question:

      "The busts occur when the datastream is interrupted or modified in the middle of a bar and the subscription is cancelled by the backend. They should be relatively uncommon but unfortunately no can't be avoided completely"

      In TWS API v978,a special error code was added to notify the application about the bust event so that the subscription could be renewed. Below is the example of such error message (from TWS Gateway API logs):

      15:24:00:896 -> 4-2-16777221-10225-Bust event occurred, current subscription is deactivated. Please resubscribe real-time bars immediately.-
      

      Currently backtrader doesn't process the bust event error code (10225).

      I've submitted PR with a fix: https://github.com/mementum/backtrader/pull/396

      (bwt this PR also fixes the issue with multiple strategies and data feeds: https://community.backtrader.com/topic/2122/live-trading-multiple-strategies-each-one-on-a-separate-data-feed, although it could be separated into its own PR if at all)

      Thanks
      Vlad

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

        @vladisld

        Very well done! May I suggest throttling the requests as well to reduce the number of disconnection/reconnections required?

        1 Reply Last reply Reply Quote 0
        • M
          mv last edited by

          @vladisld Looks like this issue still exists. I checked the PR patch to ensure my code has those changes. Today, I came across this issue with error message in TWS API logs, however there is no error message from backtrader, it continued with next() repeating last known data.

          TWS API Logs
          -> 4-2-16777217-10225-Bust event occurred, current subscription is deactivated. Please resubscribe real-time bars immediately.
          

          Thanks

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

            Could you provide more of the TWS API Logs: few lines before the event and at least 30 seconds after it.

            1 Reply Last reply Reply Quote 0
            • M
              mv last edited by

              Hi @vladisld

              Hope this is of help

              21:28:05:430 -> 49-1-1600703885-
              21:28:09:984 -> 50-3-16777221-1600703885-0.94-0.94-0.94-0.94-0-0.94-0-
              21:28:09:984 -> 50-3-16777219-1600703885-1.14-1.14-1.11-1.11-21-1.14-3-
              21:28:10:562 -> 50-3-16777217-1600703885-323.80-323.82-323.71-323.72-72-323.78-40-
              21:28:14:986 -> 50-3-16777221-1600703890-0.94-0.94-0.94-0.94-0-0.94-0-
              21:28:14:987 -> 50-3-16777219-1600703890-1.10-1.10-1.10-1.10-4-1.10-1-
              21:28:14:987 -> 50-3-16777217-1600703890-323.70-323.73-323.68-323.68-97-323.71-45-
              21:28:19:984 -> 50-3-16777221-1600703895-1.02-1.02-1.02-1.02-10-1.02-1-
              21:28:19:984 -> 50-3-16777219-1600703895-1.08-1.08-1.06-1.06-11-1.07-4-
              21:28:19:984 -> 50-3-16777217-1600703895-323.67-323.67-323.57-323.57-93-323.61-67-
              21:28:24:987 -> 50-3-16777221-1600703900-1.02-1.02-1.02-1.02-37-1.02-1-
              21:28:24:987 -> 50-3-16777219-1600703900-1.06-1.06-1.06-1.06-1-1.06-1-
              21:28:25:296 -> 50-3-16777217-1600703900-323.56-323.63-323.55-323.62-59-323.60-32-
              21:28:29:986 -> 50-3-16777221-1600703905-1.02-1.02-1.02-1.02-0-1.02-0-
              21:28:29:986 -> 50-3-16777219-1600703905-1.05-1.05-1.05-1.05-8-1.05-1-
              21:28:29:987 -> 50-3-16777217-1600703905-323.63-323.63-323.59-323.62-73-323.61-47-
              21:28:34:988 -> 50-3-16777221-1600703910-1.00-1.00-1.00-1.00-1-1.00-1-
              21:28:34:989 -> 50-3-16777219-1600703910-1.05-1.05-1.05-1.05-0-1.05-0-
              21:28:35:239 -> 50-3-16777217-1600703910-323.62-323.68-323.62-323.65-58-323.65-39-
              21:28:39:049 -> 50-3-16777221-1600703915-0.98-0.98-0.97-0.97-3-0.97-3-
              21:28:39:049 -> 50-3-16777219-1600703915-1.06-1.09-1.06-1.08-7-1.07-6-
              21:28:39:049 -> 50-3-16777217-1600703915-323.66-323.69-323.62-323.65-225-323.64-124-
              21:28:44:053 -> 50-3-16777221-1600703920-0.98-0.98-0.98-0.98-30-0.98-2-
              21:28:44:053 -> 50-3-16777219-1600703920-1.07-1.07-1.06-1.06-33-1.07-4-
              21:28:44:053 -> 50-3-16777217-1600703920-323.66-323.66-323.61-323.63-85-323.63-63-
              21:28:49:053 -> 50-3-16777221-1600703925-1.00-1.00-1.00-1.00-7-1.00-2-
              21:28:49:053 -> 50-3-16777219-1600703925-1.06-1.06-1.03-1.05-18-1.05-4-
              21:28:49:054 -> 50-3-16777217-1600703925-323.63-323.64-323.55-323.60-164-323.59-83-
              21:28:54:050 -> 50-3-16777221-1600703930-1.01-1.01-1.01-1.01-1-1.01-1-
              21:28:54:051 -> 50-3-16777219-1600703930-1.06-1.06-1.02-1.02-52-1.02-3-
              21:28:54:693 -> 50-3-16777217-1600703930-323.61-323.61-323.54-323.55-38-323.58-26-
              21:28:57:027 -> 8-1-21:28-
              21:28:57:028 -> 8-1-21:28-
              21:28:57:030 -> 7-8-439735807-SPY-OPT-20200921-324-C-100-AMEX-USD-SPY   200921C00324000-SPY-0-1.03776135-0.0-0.0-0.0--32.24-DU2694397-
              21:28:57:030 -> 8-1-21:28-
              21:28:57:030 -> 7-8-439735817-SPY-OPT-20200921-325-C-100-AMEX-USD-SPY   200921C00325000-SPY-0-0.6220638-0.0-0.0-0.0--4.04-DU2694397-
              21:28:57:030 -> 8-1-21:28-
              21:28:57:030 -> 7-8-439735837-SPY-OPT-20200921-326-C-100-AMEX-USD-SPY   200921C00326000-SPY-0-0.34293605-0.0-0.0-0.0--18.14-DU2694397-
              21:28:57:031 -> 8-1-21:28-
              21:28:57:031 -> 7-8-439735844-SPY-OPT-20200921-327-C-100-AMEX-USD-SPY   200921C00327000-SPY-0-0.1710662-0.0-0.0-0.0--7.19-DU2694397-
              21:28:57:031 -> 8-1-21:28-
              21:28:57:031 -> 7-8-439735861-SPY-OPT-20200921-328-C-100-AMEX-USD-SPY   200921C00328000-SPY-0-0.09-0.0-0.0-0.0--5.08-DU2694397-
              21:28:57:031 -> 8-1-21:28-
              21:28:57:031 -> 7-8-439736164-SPY-OPT-20200921-320-P-100-AMEX-USD-SPY   200921P00320000-SPY-0-0.296862-0.0-0.0-0.0-2.86-DU2694397-
              21:28:57:031 -> 8-1-21:28-
              21:28:57:031 -> 7-8-439736171-SPY-OPT-20200921-321-P-100-AMEX-USD-SPY   200921P00321000-SPY-0-0.45-0.0-0.0-0.0--16.81-DU2694397-
              21:28:57:031 -> 8-1-21:28-
              21:28:57:031 -> 7-8-439736174-SPY-OPT-20200921-322-P-100-AMEX-USD-SPY   200921P00322000-SPY-0-0.689782-0.0-0.0-0.0-3.35-DU2694397-
              21:28:57:032 -> 8-1-21:28-
              21:28:58:339 -> 50-3-16777217-1600703930-323.61-323.61-323.54-323.55-38-323.58-26-
              21:28:59:051 -> 50-3-16777221-1600703935-1.00-1.05-1.00-1.05-17-1.02-5-
              21:28:59:051 -> 50-3-16777219-1600703935-1.04-1.04-1.00-1.00-7-1.02-3-
              21:28:59:051 -> 50-3-16777217-1600703935-323.56-323.57-323.50-323.50-148-323.54-71-
              21:29:04:054 -> 50-3-16777221-1600703940-1.03-1.03-1.02-1.02-12-1.03-3-
              21:29:04:054 -> 50-3-16777219-1600703940-1.02-1.03-1.02-1.03-2-1.02-2-
              21:29:04:054 -> 50-3-16777217-1600703940-323.50-323.62-323.50-323.60-159-323.55-110-
              21:29:04:163 <- 3-41-63-0-SPY-OPT-20200921-324.0-CALL--SMART--USD-----BUY-3-STPLMT-1.15-1.1-GTD-5441817b-30de-4eca-af1a-7c5041ae5a4a--O-0--0-0-0-0-0-0-0-0--0.0--20200922 03:59:59-----0---1-1---0---0-0--0------0-----0-----------0---0-0--0-
              21:29:04:224 <- 3-41-64-0-SPY-OPT-20200921-324.0-CALL--SMART--USD-----SELL-3-TRAIL-0.0-0.0-GTD-6bea46ab-2d1b-4c3c-83b1-d0f1a0723f83--O-0--1-63-0-0-0-0-0-0--0.0--20200922 03:59:59-----0---1-1---0---0-0--0------0-----0---10.0--------0---0-0--0-
              21:29:04:563 <- 49-1-
              21:29:04:564 -> 49-1-1600703944-
              21:29:05:295 -> 5-32-64-439735807-SPY-OPT-20200921-324-C-100-SMART-USD-SPY   200921C00324000-SPY-SELL-3-TRAIL-0.0--GTD-685287059-DU2694397-O-0--7369101-685287060-0-0-0--685287060.0/DU2694397/100-----20200922 03:59:59 India Standard Time----0---1-0-------0-0-0--1-0-0--63-0--0-None--0----?-0-0--0-0--10.0----0-0-0-----0--IB-0-0--0-PreSubmitted-1.7976931348623157E308-1.7976931348623157E308-1.7976931348623157E308------3-6-64-PreSubmitted-0-3-0-685287060-63-0-7369101-child,trigger-
              21:29:05:298 -> 5-32-63-439735807-SPY-OPT-20200921-324-C-100-SMART-USD-SPY   200921C00324000-SPY-BUY-3-STP LMT-1.15-1.1-GTD-5441817b-30de-4eca-af1a-7c5041ae5a4a-DU2694397-O-0--7369101-685287059-0-0-0--685287059.0/DU2694397/100-----20200922 03:59:59 India Standard Time----0---1-0-------0-0-0--1-0-0--0-0--0-None--0----?-0-0--0-0------0-0-0-----0--IB-0-0--0-PreSubmitted-1.7976931348623157E308-1.7976931348623157E308-1.7976931348623157E308------3-6-63-PreSubmitted-0-3-0-685287059-0-0-7369101-trigger-
              21:29:09:050 -> 50-3-16777221-1600703945-1.02-1.02-1.02-1.02-0-1.02-0-
              21:29:09:050 -> 50-3-16777219-1600703945-1.03-1.03-1.03-1.03-2-1.03-1-
              21:29:09:050 -> 50-3-16777217-1600703945-323.58-323.64-323.55-323.63-106-323.58-52-
              21:29:14:050 -> 50-3-16777221-1600703950-1.00-1.00-0.99-0.99-7-0.99-3-
              21:29:14:050 -> 50-3-16777219-1600703950-1.03-1.03-1.03-1.03-0-1.03-0-
              21:29:19:053 -> 50-3-16777221-1600703955-0.99-0.99-0.98-0.98-5-0.98-3-
              21:29:19:053 -> 50-3-16777219-1600703955-1.04-1.06-1.04-1.06-2-1.05-2-
              **21:29:19:456 -> 4-2-16777217-10225-Bust event occurred, current subscription is deactivated. Please resubscribe real-time bars immediately.-**
              21:29:24:054 -> 50-3-16777221-1600703960-0.98-0.98-0.98-0.98-0-0.98-0-
              21:29:24:055 -> 50-3-16777219-1600703960-1.07-1.08-1.07-1.07-10-1.07-4-
              21:29:29:759 -> 50-3-16777221-1600703965-0.99-1.00-0.99-1.00-2-1.00-2-
              21:29:29:759 -> 50-3-16777219-1600703965-1.05-1.05-1.05-1.05-18-1.05-2-
              21:29:34:758 -> 50-3-16777221-1600703970-1.01-1.01-1.00-1.00-108-1.01-4-
              21:29:34:759 -> 50-3-16777219-1600703970-1.05-1.05-1.05-1.05-16-1.05-2-
              21:29:39:759 -> 50-3-16777221-1600703975-1.00-1.00-1.00-1.00-0-1.00-0-
              21:29:39:759 -> 50-3-16777219-1600703975-1.05-1.05-1.05-1.05-1-1.05-1-
              21:29:44:759 -> 50-3-16777221-1600703980-0.99-0.99-0.99-0.99-206-0.99-2-
              21:29:44:759 -> 50-3-16777219-1600703980-1.06-1.06-1.06-1.06-10-1.06-1-
              21:29:49:756 -> 50-3-16777221-1600703985-1.00-1.00-1.00-1.00-10-1.00-1-
              21:29:49:756 -> 50-3-16777219-1600703985-1.05-1.05-1.05-1.05-1-1.05-1-
              21:29:54:759 -> 50-3-16777221-1600703990-1.00-1.00-1.00-1.00-0-1.00-0-
              21:29:54:759 -> 50-3-16777219-1600703990-1.05-1.05-1.05-1.05-0-1.05-0-
              21:29:59:767 -> 50-3-16777221-1600703995-1.00-1.00-1.00-1.00-0-1.00-0-
              21:29:59:767 -> 50-3-16777219-1600703995-1.07-1.07-1.07-1.07-3-1.07-2-
              21:30:04:764 -> 50-3-16777221-1600704000-0.98-0.98-0.97-0.97-12-0.98-2-
              21:30:04:765 -> 50-3-16777219-1600704000-1.07-1.07-1.06-1.06-61-1.06-3-
              21:30:04:910 <- 50-2-16777234-756733-SPY-STK--0.0---SMART-ARCA-USD-SPY-SPY-5-TRADES-0-
              21:30:05:327 <- 49-1-
              21:30:05:328 -> 49-1-1600704005-
              21:30:09:758 -> 50-3-16777221-1600704005-0.98-0.98-0.97-0.97-3-0.98-2-
              21:30:09:758 -> 50-3-16777219-1600704005-1.06-1.06-1.06-1.06-0-1.06-0-
              21:30:14:758 -> 50-3-16777221-1600704010-0.97-0.97-0.94-0.94-56-0.97-5-
              21:30:14:758 -> 50-3-16777219-1600704010-1.08-1.08-1.07-1.07-12-1.07-2-
              
              1 Reply Last reply Reply Quote 0
              • vladisld
                vladisld last edited by

                hmm, seems like the patch either doesn't work or missing.

                it should have looked like the following log:

                **20:37:31:657 -> 4-2-16777223-10225-Bust event occurred, current subscription is deactivated. Please resubscribe real-time bars immediately.-
                **20:37:31:982 <- 51-1-16777223-
                **20:37:31:989 <- 50-2-16777224-6248713-FFIV-STK--0.0---SMART-NASDAQ-USD-FFIV-NMS-5-TRADES-0-
                20:37:32:349 -> 50-3-16777224-1600461445-120.84-120.84-120.84-120.84-0-120.84-0-
                20:37:35:493 -> 50-3-16777221-1600461450-13.80-13.80-13.80-13.80-0-13.80-0-
                20:37:35:494 -> 50-3-16777224-1600461450-120.84-120.84-120.84-120.84-0-120.84-0-
                20:37:35:494 -> 50-3-16777217-1600461450-59.93-59.93-59.93-59.93-0-59.93-0-
                

                here the 51 code stands for CANCEL_REAL_TIME_BARS and 50 for REQ_REAL_TIME_BARS messages

                You may try to insert some prints in ibdata.py in the error processing code around lines 513-518 I guess. The code there looks like the following:

                                elif msg == -10225:  # Bust event occurred...
                                    self._subcription_valid = False
                                    if not self._statelivereconn:
                                        self._statelivereconn = self.p.backfill
                                        self.reqdata()  # resubscribe
                                    continue
                

                and see if the code flow actually enters this region.

                1 Reply Last reply Reply Quote 2
                • M
                  mv last edited by

                  Yes, it's entering the code block, I could see the two prints in BT logs, however resubscribe is not happening. If you see Ib TWS logs below, SPY data is missing after the burst. Only option data is being received. Before burst happened you can see SPY data 50-3-16777217-1600880190-328.54-328.58-328.53-328.57-81-328.56-54-

                                  elif msg == -10225:  # Bust event occurred, current subscription is deactivated.
                                      print("*" * 50 + "In feeds/ibdata.py")
                                      self._subcription_valid = False
                                      if not self._statelivereconn:
                                          print("feeds/ibdata.py --- in If")
                                          self._statelivereconn = self.p.backfill
                                          self.reqdata()  # resubscribe
                                      continue
                  
                  22:26:14:488 -> 50-3-16777217-1600880170-328.55-328.57-328.55-328.56-26-328.56-13-
                  22:26:19:485 -> 50-3-16777221-1600880175-0.61-0.63-0.61-0.63-30-0.62-3-
                  22:26:19:485 -> 50-3-16777219-1600880175-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:26:19:485 -> 50-3-16777217-1600880175-328.59-328.65-328.55-328.56-326-328.60-167-
                  22:26:24:486 -> 50-3-16777221-1600880180-0.64-0.64-0.64-0.64-50-0.64-1-
                  22:26:24:487 -> 50-3-16777219-1600880180-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:26:24:843 -> 50-3-16777217-1600880180-328.56-328.56-328.54-328.55-111-328.56-69-
                  22:26:29:486 -> 50-3-16777221-1600880185-0.64-0.64-0.64-0.64-0-0.64-0-
                  22:26:29:486 -> 50-3-16777219-1600880185-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:26:30:184 -> 50-3-16777217-1600880185-328.55-328.56-328.53-328.56-119-328.55-75-
                  22:26:32:762 -> 50-3-16777217-1600880185-328.55-328.56-328.53-328.56-119-328.55-75-
                  22:26:34:491 -> 50-3-16777221-1600880190-0.65-0.66-0.65-0.66-11-0.65-3-
                  22:26:34:493 -> 50-3-16777219-1600880190-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:26:35:313 -> 50-3-16777217-1600880190-328.54-328.58-328.53-328.57-81-328.56-54-
                  22:26:39:715 -> 50-3-16777221-1600880195-0.66-0.66-0.66-0.66-0-0.66-0-
                  22:26:39:715 -> 50-3-16777219-1600880195-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:26:44:927 -> 50-3-16777221-1600880200-0.64-0.67-0.64-0.67-14-0.65-3-
                  22:26:44:928 -> 50-3-16777219-1600880200-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:26:45:692 -> 4-2-16777217-10225-Bust event occurred, current subscription is deactivated. Please resubscribe real-time bars immediately.-
                  22:26:46:154 <- 49-1-
                  22:26:46:154 -> 49-1-1600880206-
                  22:26:49:943 -> 50-3-16777221-1600880205-0.67-0.67-0.67-0.67-0-0.67-0-
                  22:26:49:944 -> 50-3-16777219-1600880205-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:26:54:927 -> 50-3-16777221-1600880210-0.67-0.67-0.67-0.67-0-0.67-0-
                  22:26:54:928 -> 50-3-16777219-1600880210-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:26:59:926 -> 50-3-16777221-1600880215-0.67-0.67-0.67-0.67-0-0.67-0-
                  22:26:59:927 -> 50-3-16777219-1600880215-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:27:04:925 -> 50-3-16777221-1600880220-0.67-0.67-0.67-0.67-0-0.67-0-
                  22:27:04:926 -> 50-3-16777219-1600880220-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:27:04:972 <- 50-2-16777228-756733-SPY-STK--0.0---SMART-ARCA-USD-SPY-SPY-5-TRADES-0-
                  22:27:09:936 -> 50-3-16777221-1600880225-0.65-0.67-0.65-0.67-38-0.67-5-
                  22:27:09:937 -> 50-3-16777219-1600880225-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:27:14:927 -> 50-3-16777221-1600880230-0.66-0.66-0.66-0.66-21-0.66-2-
                  22:27:14:928 -> 50-3-16777219-1600880230-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:27:19:931 -> 50-3-16777221-1600880235-0.66-0.66-0.66-0.66-1-0.66-1-
                  22:27:19:932 -> 50-3-16777219-1600880235-1.82-1.82-1.82-1.82-0-1.82-0-
                  22:27:22:116 -> 8-1-22:27-
                  22:27:22:117 -> 8-1-22:27-
                  22:27:22:119 -> 7-8-440547231-SPY-OPT-20200923-330-P-100-AMEX-USD-SPY   200923P00330000-SPY-0-1.76159155-0.0-0.0-0.0-15.58-DU2694397-
                  22:27:22:119 -> 8-1-22:27-
                  22:27:22:119 -> 7-8-441692001-SPY-OPT-20200923-327-C-100-AMEX-USD-SPY   200923C00327000-SPY-0-1.91999995-0.0-0.0-0.0--9.88-DU2694397-
                  22:27:22:119 -> 8-1-22:27-
                  22:27:22:119 -> 7-8-441692083-SPY-OPT-20200923-329-P-100-AMEX-USD-SPY   200923P00329000-SPY-0-1.10763205-0.0-0.0-0.0--63.37-DU2694397-
                  22:27:22:119 -> 8-1-22:27-
                  22:27:24:928 -> 50-3-16777221-1600880240-0.65-0.65-0.64-0.64-30-0.64-3-
                  22:27:24:928 -> 50-3-16777219-1600880240-1.91-1.94-1.91-1.93-112-1.94-3-
                  22:27:29:404 -> 50-3-16777221-1600880245-0.64-0.64-0.64-0.64-0-0.64-0-
                  22:27:29:405 -> 50-3-16777219-1600880245-1.95-1.95-1.95-1.95-1-1.95-1-
                  22:27:34:405 -> 50-3-16777221-1600880250-0.62-0.62-0.61-0.61-4-0.62-2-
                  22:27:34:406 -> 50-3-16777219-1600880250-1.95-1.95-1.95-1.95-0-1.95-0-
                  22:27:39:409 -> 50-3-16777221-1600880255-0.61-0.61-0.61-0.61-2-0.61-2-
                  22:27:39:410 -> 50-3-16777219-1600880255-1.95-1.95-1.95-1.95-0-1.95-0-
                  22:27:44:403 -> 50-3-16777221-1600880260-0.61-0.61-0.61-0.61-2-0.61-2-
                  22:27:44:404 -> 50-3-16777219-1600880260-2.00-2.00-1.98-1.98-13-1.98-3-
                  22:27:45:664 <- 49-1-
                  22:27:45:664 -> 49-1-1600880265-
                  22:27:49:400 -> 50-3-16777221-1600880265-0.61-0.61-0.61-0.61-15-0.61-2-
                  22:27:49:400 -> 50-3-16777219-1600880265-1.98-1.98-1.98-1.98-0-1.98-0-
                  22:27:54:405 -> 50-3-16777221-1600880270-0.62-0.62-0.62-0.62-1-0.62-1-
                  22:27:54:406 -> 50-3-16777219-1600880270-1.98-1.98-1.98-1.98-0-1.98-0-
                  22:27:59:403 -> 50-3-16777221-1600880275-0.63-0.63-0.63-0.63-29-0.63-1-
                  22:27:59:403 -> 50-3-16777219-1600880275-1.91-1.91-1.91-1.91-15-1.91-1-
                  22:28:04:400 -> 50-3-16777221-1600880280-0.66-0.66-0.64-0.64-96-0.65-3-
                  22:28:04:400 -> 50-3-16777219-1600880280-1.91-1.91-1.91-1.91-0-1.91-0-
                  22:28:09:846 -> 50-3-16777221-1600880285-0.64-0.64-0.64-0.64-3-0.64-1-
                  22:28:09:849 -> 50-3-16777219-1600880285-1.91-1.91-1.91-1.91-0-1.91-0-
                  22:28:14:844 -> 50-3-16777221-1600880290-0.64-0.64-0.64-0.64-0-0.64-0-
                  22:28:14:845 -> 50-3-16777219-1600880290-1.91-1.91-1.91-1.91-0-1.91-0-
                  22:28:19:846 -> 50-3-16777221-1600880295-0.65-0.65-0.65-0.65-50-0.65-1-
                  22:28:19:851 -> 50-3-16777219-1600880295-1.91-1.91-1.91-1.91-0-1.91-0-
                  22:28:24:844 -> 50-3-16777221-1600880300-0.65-0.65-0.65-0.65-2-0.65-1-
                  22:28:24:845 -> 50-3-16777219-1600880300-1.93-1.93-1.93-1.93-2-1.93-1-
                  22:28:29:853 -> 50-3-16777221-1600880305-0.64-0.64-0.64-0.64-88-0.64-2-
                  22:28:29:854 -> 50-3-16777219-1600880305-1.93-1.93-1.93-1.93-0-1.93-0-
                  22:28:34:847 -> 50-3-16777221-1600880310-0.64-0.64-0.64-0.64-0-0.64-0-
                  22:28:34:847 -> 50-3-16777219-1600880310-1.93-1.93-1.93-1.93-0-1.93-0-
                  22:28:39:851 -> 50-3-16777221-1600880315-0.64-0.64-0.63-0.63-6-0.64-4-
                  22:28:39:852 -> 50-3-16777219-1600880315-1.93-1.93-1.93-1.93-0-1.93-0-
                  22:28:44:845 -> 50-3-16777221-1600880320-0.63-0.63-0.63-0.63-1-0.63-1-
                  22:28:44:845 -> 50-3-16777219-1600880320-1.93-1.93-1.93-1.93-0-1.93-0-
                  22:28:46:156 <- 49-1-
                  22:28:46:156 -> 49-1-1600880326-
                  22:28:49:283 -> 50-3-16777221-1600880325-0.63-0.63-0.63-0.63-0-0.63-0-
                  22:28:49:284 -> 50-3-16777219-1600880325-1.94-1.94-1.93-1.93-3-1.93-2-
                  
                  1 Reply Last reply Reply Quote 0
                  • vladisld
                    vladisld last edited by

                    This is strange indeed. In case you see the print inside the if not self._statelivereconn: - if we follow the code flow - it seems nothing should prevent issuing another subscription. It means that the appropriate request should have been seen in the API logs - but apparently it did not.

                    On another note:

                    Just compared the patch in the master branch of mementum\backtrader repository and my fork and there are some differences. In particular the patch in mementum\backtrader lacks the subscription cancellation code.

                    I'll upload the updated PR in the coming days after additional testing.

                    You may try to use my fork (https://github.com/vladisld/backtrader in 'lazytrader' branch) or just take a diff of ibdata.py and ibstore.py from there and see if it works for you until the updated PR will be uploaded.

                    1 Reply Last reply Reply Quote 0
                    • M
                      mv last edited by

                      Thanks @vladisld for your inputs.

                      I tried with the files you mentioned but it didn't help, still facing the issue now and then. Will look forward to your testing and patch. I can help you with testing too.

                      Thanks

                      1 Reply Last reply Reply Quote 0
                      • M
                        mv last edited by

                        Hi @vladisld,

                        I've added self.canceldata() before resubscribing and this fix seems to work. You might want to incorporate this in your patch after testing.

                                        elif msg == -10225:  # Bust event occurred, current subscription is deactivated.
                                            self._subcription_valid = False
                                            if not self._statelivereconn:
                                                self._statelivereconn = self.p.backfill
                                                self.canceldata() # Cancel before resubscribing
                                                self.reqdata()  # resubscribe
                                            continue
                        
                        1 Reply Last reply Reply Quote 0
                        • vladisld
                          vladisld last edited by

                          The code in my fork already contains this fix - strange it didn't work for you

                          1 Reply Last reply Reply Quote 0
                          • M
                            mv last edited by

                            @vladisld In that case, I could have picked up wrong files. Anyways, good to hear that this is the solution for the issue. Thanks for your continued support. Appreciate!

                            1 Reply Last reply Reply Quote 0
                            • M
                              mv last edited by

                              @vladisld Even with this fix, I still see the issue. Worked once and failed twice.

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