Hi, Im trying to write a simple system Direct to TWs, but have hita brick wall. Ive been at it all day, but still not able to recieve data from TWS. Does anyone out there have any experience with the TWS API? Or does anyone know of any quirks or traps with it? Ive tried even running the demo code, but that doesnt even seem to work.... Any help on this would be much appreciated. Thanks
If you cannot get the demo code working it is unlikely that you can get some custom app working. Does the Standalone TWS Workstation work? Quotes, MarketDepth, Charts??? Good luck
Here's the link to the quick start guides...they should tell you what you need to know. http://www.interactivebrokers.com/en/p.php?f=programInterface Make sure TWS is configured to work with the API. There's a setting or two you need to enable in the TWS options.
the most common error would be to forget enabling socket connections or be communicating on the wrong port, see here : http://code.google.com/p/tradelink/wiki/TwsConfiguration beyond that you would need to provide more details about what you're doing or what doesn't work.
Guys, thanks for the replies, I will go through each of them. My program connects to IB successfully, when I request to retrieve live data for some Symbol (Stock or Option), it did not return anything, no data and no any error message, I have tried to request 5 second and 30 second data and even after waiting 5 minutes no output. Ill go through those suggestions though
To make sure you are actually connecting to TWS, call the TWS Connect() routine twice in a row. This will generate an "already connected" error message (might be #202, check the error code list). If you are truly connected to TWS, you should get feedback when you try to request data: either you start recieving data, or you will receive errors because you didn't specify the contract correctly or asked for an incorrect format.
since we dont know what you did help will be limited. you need to implement the interfaces 1) class QuoteRequester implements EWrapper,Constants { ... } 2) create contracts ... Contract contract = new Contract(); 3) use those contracts in m_client.reqMktData() 4) print some stuff out inthe error() methods 5) print stuff out in tickPrice()
Also, your best bet is to get the TWS example code running for starters...the sample code is pretty thorough and has all the bare bones to make sure you are implementing things correctly.