Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Spurious OnPositionUpdate?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Spurious OnPositionUpdate?

    Hi,

    This issue might be related to the previous discussion about excess events with IB. I'm currently using IB TWS with the .8 build of NT.

    I just noticed some strange messages in my output... I'm not sure of what I'm looking yet, and I'll dig deeper. But it sure *looks* like OnPositionUpdate() is being called, even when the position hasn't changed. (No orders have been processed, at all.)

    My OnPositionUpdate() is currently coded to assume that *if* it is called at all, it's because an exit/entry order has just been filled... I have either gone from Flat->Long, or Long->Flat. If OnPositionUpdate() is being called for no reason at all, then.. well, I have to figure out another fix.

    Any suggestions?

    #2
    heech,

    Not sure without more information. In general, OnPositionUpdate() should not trigger unless you had a position update event.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      heech,

      Not sure without more information. In general, OnPositionUpdate() should not trigger unless you had a position update event.
      Ok, it's definitely happening. It looks like there's a bug here, either on the IB or NT side. I added a bunch of debugging messages, and they just fired for me.

      Looking at the log, I think there's information here that will help you guys track it down. Here's what I show... in chronological order (reverse from log order):

      3/3/2009 11:00:04 AM,Execution,Execution='SKF/00012c6a.49ad12a5.01.01' Instrument='SKF' Account='U634472' Exchange=Arca Price=205.55 Quantity=100 Market position=Long Operation=Insert Order='826097210' Time='3/3/2009 11:00:04 AM',
      3/3/2009 11:00:05 AM,Position,Instrument='SKF' Account='' Avg price=205.56 Quantity=100 Market position=Long Operation=Insert Currency=UsDollar,

      I did exit SKF at this point.
      Two seconds later, immediately following:


      3/3/2009 11:02:10 AM,Position,Instrument='SKF' Account='' Avg price=1.79769313486232E+308 Quantity=0 Market position=Long Operation=Remove Currency=UsDollar,

      No idea what the bizarre "price" value here is about.
      This is immediately followed by ALL of my IB positions (40+) scrolling through the log, all time stamped with 3/3/2009 11:02:10, and all with Operation=Insert.

      3/3/2009 11:02:11 AM,Position,Instrument='MEE' Account='xxxxxx' Avg price=10.355 Quantity=1,000 Market position=Long Operation=Insert Currency=UsDollar,

      I believe that whatever event caused all of the IB positions to scroll through the log with the "Position" message also called OnPositionUpdate() to be fired again, although the position hadn't changed.
      Last edited by heech; 03-03-2009, 01:20 PM.

      Comment


        #4
        Sorry heech. What exactly is the area of concern? Are you saying OnPositionUpdate triggered when no position update was indeed incurred? From the quantity it seems to show that you had 100 and are now 0.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          Sorry heech. What exactly is the area of concern? Are you saying OnPositionUpdate triggered when no position update was indeed incurred?
          Yep, that's it.

          I've been using OnPositionUpdate to catch when I exit/enter a position with stop/limit order, because OnOrderUpdate isn't usable on IB. So don't know what to do if OnPositionUpdate is firing arbitrarily.

          Comment


            #6
            Okay. Please walk me through just the chronology of one position. What I am seeing right now is you going from 100 to 0. It looks fine to me from that standpoint.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              Okay. Please walk me through just the chronology of one position. What I am seeing right now is you going from 100 to 0. It looks fine to me from that standpoint.
              Yep, that part of it is correct (other than the spurious "price", but perhaps that field isn't used when Operation=Remove).

              There's not really much to show... it's just that at this point, the log shows all of my Positions are "inserted" again. Every single position is "correct", but they were already in the system. They're just duplicated for no reason.

              3/3/2009 11:02:11 AM,Position,Instrument='SRS' Account='' Avg price=92.2796 Quantity=100 Market position=Long Operation=Insert Currency=UsDollar,
              3/3/2009 11:02:11 AM,Position,Instrument='SKF' Account='' Avg price=205.56 Quantity=100 Market position=Long Operation=Insert Currency=UsDollar,
              3/3/2009 11:02:11 AM,Position,Instrument='ANR' Account='' Avg price=15.75333335 Quantity=600 Market position=Long Operation=Insert Currency=UsDollar,
              3/3/2009 11:02:11 AM,Position,Instrument='JOYG' Account='' Avg price=16.07498335 Quantity=600 Market position=Long Operation=Insert Currency=UsDollar,
              3/3/2009 11:02:11 AM,Position,Instrument='WFC' Account='' Avg price=10.885 Quantity=1,200 Market position=Long Operation=Insert Currency=UsDollar,
              3/3/2009 11:02:11 AM,Position,Instrument='MEE' Account='' Avg price=10.355 Quantity=1,000 Market position=Long Operation=Insert Currency=UsDollar,
              3/3/2009 11:02:11 AM,Position,Instrument='+GNK 03-09 C 10' Account='' Avg price=1.79769313486232E+308 Quantity=0 Market position=Long Operation=Remove Currency=UsDollar,
              3/3/2009 11:02:11 AM,Position,Instrument='+CI 03-09 C 12.5' Account='' Avg price=1.79769313486232E+308 Quantity=0 Market position=Long Operation=Remove Currency=UsDollar,

              Comment


                #8
                heech,

                Can you see if you have received OnExecution events correlated to these OnPositionUpdates? As far as the positions go you want to check the quantity to be > 0 before looking at any of the other parameters.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Josh View Post
                  heech,

                  Can you see if you have received OnExecution events correlated to these OnPositionUpdates? As far as the positions go you want to check the quantity to be > 0 before looking at any of the other parameters.
                  Josh,

                  Absolutely no OnExecution events. I would see debug messages, and I'd also expect to see it in the NT log.

                  And I'm sure quantity is > 0 here as well... I think OnPositionUpdate event is being delivered exactly as the log shows (with positive quantity). The question is why there's a Position event at all.

                  Comment


                    #10
                    Valid question. I would want to understand why that is, please:
                    - send me your trace and log file to "dierk AT ninjatrader DOT com"
                    - let me know around what time you saw the spurious OnPositionUpdate event

                    Thanks

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    633 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    364 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    105 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    567 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    568 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X