Announcement

Collapse
No announcement yet.

smart route in IBBridge is causing trouble

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

  • #16
    Good Morning,

    Just posting an update to some recent testing with the OBCBridge 1.2.724.1134 and IB.


    closePosition() is now working.

    cancelOrder() is not working.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #17
      Originally posted by JasonK
      Good Morning,

      Just posting an update to some recent testing with the OBCBridge 1.2.724.1134 and IB.


      closePosition() is now working.

      cancelOrder() is not working.
      Hi Jason,

      Thanks very much for the help and update,

      Was wondering if your testing included also placing orders for the same symbol manually via TWS and within an EFS strategy?

      The reason I as is that if the last position was created via an order using TWS, closeposition() would fail but with a different error messages then a "duplicate order".

      I don't have message log screen image on this systems but something like ", cannot modify order arrtributes for partially executed order".

      However simply repeating the closePoistion() function again seemed to work the second time.

      Which leads me to a question,how does closePosition() close a postion: by simply generating an offsetting order if long for example, to SELL XXX SHARES MARKET, or by some other mechanism?

      If so that raises some timing consideration as is it possible when using the closePosition() function to over sell/buy more then origional position if for example the function is use numerous times while in a postion.

      Or hopefully it's behavior is much more benign.

      The reason I ask is if closePosition() does not automatically send out an offsetting order then I was considering a less then elegant workaround of simply stacking two closePosition() in the event the last trade was via TWS, the first one would generate an error and the second one should work?
      Glen Demarco
      [email protected]

      Comment


      • #18
        Hello Glen,

        Originally posted by demarcog
        Hi Jason,

        Thanks very much for the help and update,

        Was wondering if your testing included also placing orders for the same symbol manually via TWS and within an EFS strategy?

        The reason I as is that if the last position was created via an order using TWS, closeposition() would fail but with a different error messages then a "duplicate order".

        I don't have message log screen image on this systems but something like ", cannot modify order arrtributes for partially executed order".

        However simply repeating the closePoistion() function again seemed to work the second time.
        Yes, this was tested, see my reply on 1/30 in this thread. It has to do with the Client ID that is set in eSignal.

        If you are using closePosition() in your account to close a real position, the possibility that the position would be partially closed could occur, which is dependant on the default settings for the order type. If you can set the order type to default to fill or kill (or equivalent), the partial fills could be avoided. In a demo or simulated mode, I don't think liquidity is taken into consideration so the entire position gets closed.

        Which leads me to a question,how does closePosition() close a postion: by simply generating an offsetting order if long for example, to SELL XXX SHARES MARKET, or by some other mechanism?
        It should be an offsetting order. Turn order confirmation on and you can check all of the properties of the order to verify this.

        If so that raises some timing consideration as is it possible when using the closePosition() function to over sell/buy more then origional position if for example the function is use numerous times while in a postion.

        Or hopefully it's behavior is much more benign.
        That's an interesting scenario. This revolves around what fail safes are put in place. EFS does not have anything to prevent this from happening. If you had an error in your code logic that called this function twice in a row I believe it would create two orders. There may be some fail safes within the broker application. You will have to check with the particular broker to find out for sure.

        The reason I ask is if closePosition() does not automatically send out an offsetting order then I was considering a less then elegant workaround of simply stacking two closePosition() in the event the last trade was via TWS, the first one would generate an error and the second one should work?
        EFS does not currently have any method to detect an error that might occur on the first call of closePosition(). This would require some additional functionality to be added to the GB collection. Feel free to submit this idea or any that you come across to [email protected].
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment


        • #19
          Jason,

          Great suggestions to use FIll or Kill and turning on order confirmation to track the mechanism by which closePosition() works.

          Assuming that an offsetting order is generated implies that the closePosition() function already has the following information:

          - position status., ie., whether there is a position for the symbol AKA (Strategy.isInPosition)
          - long or short AKA (Strategy.isLong OR Strategy.isShort)
          - position size

          The implication being that the code is already completed, tested, and working well within the current implementation of closePosition().

          Is there any possibility that source could be made available or, the needed functionality described provided elsewhere?

          This IMHO, would provide the one small missing component (position status) that would enable EFS strategies to reach their fulll design potential.

          Implemeting automated trading strategies in realtime with a real account without the ability to query position status
          is much more problematic then I realized.

          Having this ability would be a tremendous aid to anyone currently using or planning to use EFS strategies.


          Once again, cannot thank you enough for all your invaluable assistance and for taking the time to research these issues as it is greatly appreciated and crucially instrumental.


          Glen
          Glen Demarco
          [email protected]

          Comment


          • #20
            Hello Glen,

            You're most welcome as always.

            I do understand the functionality you've described that is needed to accomplish auto-trading in EFS. However, the necessary EFS functions simply do not exist yet. These are the types of ideas and requests that you should submit to [email protected].
            Jason K.
            Project Manager
            eSignal - an Interactive Data company

            EFS KnowledgeBase
            JavaScript for EFS Video Series
            EFS Beginner Tutorial Series
            EFS Glossary
            Custom EFS Development Policy

            New User Orientation

            Comment


            • #21
              Jason,

              As suggested I sent an email.


              FWIW:

              I did some testing and with the latest TWS closePosition() does indeed generate an offsetting order for any positions held at the time the function is invoked theis was verified by using your suggestion of setting the default of "confirm order".

              If closePosition() is invoked multiple times while a position is held, multiple orders offsetting that original position will be generated with the possible consequence of "over buying/selling".

              If closePosition() is invoked within an EFS while a position is held after an manually entered trade submitted using TWS, a "duplicate order" as you documented will occur.

              However if closePosition() is run a second time immediately after the "duplicate error" message the position will be closed.

              If closePosition() is invoked without holding a position then no action is taken or messages sent, which may be useful as a means of "reseting" or "resyncing" an EFS with TWS by using this function prior to initiating a new trade.

              If you didn't have a position there's no problem, if you had a position it is closed.

              The real exposure as you suggested is in executing multiple closePositions(), thereby stacking multiple orders erroneously.


              Also TWS doesn't seem to support the Fill or Kill order option but does support the IOC, Immediate or Cancel which may provide the same functionality (never got the difference between those two order types anyway(.




              Thanks Again,


              Glen
              Last edited by demarcog; 02-01-2007, 01:52 PM.
              Glen Demarco
              [email protected]

              Comment


              • #22
                Hi,

                is the IBBridge now working correctly?

                regards
                sams

                Comment

                Working...
                X