IB TWS Data Issues + API

Discussion in 'Data Sets and Feeds' started by walterjennings, Mar 22, 2007.

  1. I ran into a new issue with my automated system yesterday. I shutdown TWS and my app around 11 PM (before the 12 IB server reset.. huge hassle, if anyone knows a good automated way to get around this). and restarted them both around 12:40 am. Data was coming in fine so I went to bed. When I woke up in the morning I discovered TWS' data feed froze around 3am, requiring a manual TWS restard, so it missed out on a whole night's worth of trading. My system would be able to detect TWS' data feed freezes, but Im not sure if there is any way to force TWS to reconnect through the API. Does anyone have any ideas?
     
  2. I doubt you could do it thru the IB API, but it should be easy enough to do with external code from your trading program, or a macro-scheduler like AutoIt.

    If you can do it from the Keyboard/mouse, you can do it from an AutoIt script. Your trading program would just detect an error, then start your "TWS restart script".


    http://www.autoitscript.com/autoit3/
     
  3. I am unsure about the "force reconnect".... never attempted that way. I do notice normally when the quotes freeze really nothing you can do but restart tws.... Why not just have your application kill the currently running tws and then launch it again?
     
  4. hmm thats something ill have to look into. not 100% sure how to kill TWS from my app, i usually dont waste any of my time programming stuff for windows. can an AutoIt script close a running app easily? or will the windows have to be positioned correctly for the mouse clicks etc.
     
  5. Walter,

    I don't suggest using AutoIt script. What language are you programming in, its really easy to kill applications from another one.
     
  6. Yeah, it would be neater to do it from your app, but then you have the hassle of filling in ID/Password, etc, to completely restart TWS, if I'm understanding the OP correctly.


    Walter:
    With AutoIt you can use cursor position, or window functions. Definitely is a learning curve, but it is darn powerful imho.
     
  7. ok. I'll play around with AutoIt. IB should really get their act together. There is no reason why TWS->IB connections should'nt be bulletproof.
     
  8. An easy way to restart TWS is IBController... thats what I use to turn on my bot everymorning.. works great
     
  9. can you define times to shutdown and restart TWS? multiple times a day?
     
  10. #10     Mar 22, 2007