IB DDE Excel: is it now possible to automate trailing orders

Discussion in 'Interactive Brokers' started by allesim, Dec 10, 2001.

  1. ajax_g

    ajax_g

    As far as I understand IB has an on line "simulator" where developers can test their programs before they use them in real market conditions. This is very wise, no doubt.

    Is this "simulator" available to everybody or you need to open an IB account first and become a customer of IB?

    thanks
     
    #21     Dec 29, 2001
  2. jwcrim

    jwcrim

    The tws.xls and ddedll.dll are current as of 12/29/01. Using the edemo to test the dde operation:

    The IBJts\darykq\user.ini file holds "DdeId=idxxxxxxx" from the last activity where idxxxxxxx is the highest id number last used.

    When you start up the next time, the JAVA tws applet reads this in and ignores any orders with id numbers lower than this as "possible duplicates" (according to the log). Since these ids are Time number derived, much of the next day's orders are ignored. The order counter "genid" which is appended to the Time number does not lessen this problem.

    If the tws applet is supposed to reset the user.ini's DdeId value to zero at the start of a new day, it is not happening in our testing.

    If before connecting to edemo, we open user.ini and manually reset DdeId to "DdeId=id0", then new orders are accepted normally. This method however may not protect you against old orders left on tws.xls from yesterday being resent, so you may have to strip them out as with earlier versions.

    It seems to us that if the id number contained both the date and the time (need more digits at tws.xls), the system would work as planned.
     
    #22     Dec 29, 2001
  3. bennyo

    bennyo Guest

    Yes, I Agree.
    If you change the excel function makeid so that is works over
    multiple days there is no problem.
    I use my own ID's in my own tradeprogram, starting with 1 and
    increasing. Every ID I use logs into a database, so I'm not reusing
    the same id for my next trades.

    Greetings
    Benny,
     
    #23     Dec 31, 2001
  4. mskl

    mskl

    I'm just trying to test a sample Excel spreadsheet I brought up and I keep losing my quotes. The quotes in my TWS under the Excel page keep updating but in Excel they stop/freeze every 10 to 20 minutes. I have to close both my TWS and Excel page then bring them back up for the quotes to work again.

    Anyone else notice this?? (perhaps they are testing the Excel Integration??)


    I think IB should have something that informs the Excel user that their quotes are frozen as it will be very dangerous if traders have autometed some of their trading based on quotes that are frozen.


    I was running only 20 equity quotes........
     
    #24     Dec 31, 2001
  5. jwcrim

    jwcrim

    Thanks for the comment. Your experience shows that the tws JAVA applet will accept any ascending id integer up to seven digits and is not concerned about format or correlation with approximate time. To get order time on record, I assume you time-stamp the records in your database.
     
    #25     Dec 31, 2001
  6. dlincke

    dlincke

    I'd definitely consider this global and persistent ID checking behavior a bug. Whenever several independent applications concurrently make use of the DDE Server major problems are practicall guaranteed. The only workaround is to have all applications log their IDs to a shared database and make sure with an appropriate locking mechanism that there's no concurrent read or write access to the record. The other tricky question is what happens when the ID count needs to be rolled over which assuming a 32 bit integer to keep track of the IDs will happen after 2^32 (unsigned) or 2^16 (signed) transactions. It would not surprise me if the DLL simply crashed at that point.

    IMO. the proper way to implement this is to have separate independent ID namespaces for each DDEML DDE conversation and have ID integrity only checked within but not across namespaces.

    Dave
     
    #26     Jan 1, 2002
  7. jwcrim

    jwcrim

    Some of our attempts to simultaneously run more than than one application (having "advise" ticker conversations with the tws's dde server) have resulted in one application's conversations eventually being halted - usually in the first application. The second one seems to continue successfully. Some find that if either client application disconnects both clients stop working.

    We haven't looked into it very much. This may or may not be due to the limitations of the tws ddedll.dll. Perhaps others have had better luck with multiple applications.

    The id problem probably could be handled by allowing a half dozen more id digits and letting the user work out his own solution. Default could be (Date+Time)*10^7+genid. It would be great if the last id as seen by the IB tws could be monitored at the applications with a dedicated "advise" loop.

    In spite of the id confusion, we see the dde API as being pretty useful and a welcome addition.
     
    #27     Jan 1, 2002