walterjennings: yes, faster is better -- in my opinion.
Anyway, here's what I do to run the out-of-the-box API:
start the TWS papertrading account
configure->api (check "Enable ActiveX and Socket Clients")
java -jar jtsclient.jar
A GUI labeled "Sample" should appear. It has three text windows and a lot of buttons on its right side.
Press the "Connect" button, then a dialog box labeled "Connect" will pop up. Press its "OK" button (the IP address doesn't need to change if you're running the API on the same box that TWS is running on). If that succeeded, you'll see some messages in the lower two text boxes of "Sample."
In the middle box, the TWS server version and next valid order id will appear. In the lowest box, some info about data farm connectivity should appear.
Next, to get some market data, hit the "Req Mkt Data" button. A form pops up and can be filled out with this info:
Symbol: ES
Security Type: FUT
Exchange: GLOBEX
Primary Exchange: GLOBEX
Local Symbol: ESH7
Leave the other fields alone. Hit "OK"
You should then see some messages in the upper text window of "Sample," showing things like "lastSize," "volume," "askPrice," etc.
If you do this during after hours when the data comes slowly, you can see that changes in an ES ticker on the TWS window appear as text messages in the "Sample" window. It is interesting that if the last volume was, say, 5852, then just one transaction, that there are two lastSize messages of 1, followed by a volume message of 5853.
I found the info to plug into the market data request form by rooting through some of my log files -- they have names log.Mon.txt. Another way to get the contract details could be to right click on a TWS ticker and select "contract details."
Now, try hitting "Disconnect."
A pop-up indicating that an exception occurred appears! Hit its "OK" button, then a "Connection Closed" pop-up appears. Hit its "OK" button, then another "Connection Closed" pop-up appears (there must have been two "connections"). Hit its "OK" button. Hit the "Close" button.
Next, I'll go through using the out-of-the-box API to enter and exit a position in ES. I'll also begin looking at the Java code to find out what pressing the "Req Mkt Data" button causes to happen. Another interesting thing to find out is where are the price and volume events being processed. It is when those events arrive that a bot has work to do.
Anyway, here's what I do to run the out-of-the-box API:
start the TWS papertrading account
configure->api (check "Enable ActiveX and Socket Clients")
java -jar jtsclient.jar
A GUI labeled "Sample" should appear. It has three text windows and a lot of buttons on its right side.
Press the "Connect" button, then a dialog box labeled "Connect" will pop up. Press its "OK" button (the IP address doesn't need to change if you're running the API on the same box that TWS is running on). If that succeeded, you'll see some messages in the lower two text boxes of "Sample."
In the middle box, the TWS server version and next valid order id will appear. In the lowest box, some info about data farm connectivity should appear.
Next, to get some market data, hit the "Req Mkt Data" button. A form pops up and can be filled out with this info:
Symbol: ES
Security Type: FUT
Exchange: GLOBEX
Primary Exchange: GLOBEX
Local Symbol: ESH7
Leave the other fields alone. Hit "OK"
You should then see some messages in the upper text window of "Sample," showing things like "lastSize," "volume," "askPrice," etc.
If you do this during after hours when the data comes slowly, you can see that changes in an ES ticker on the TWS window appear as text messages in the "Sample" window. It is interesting that if the last volume was, say, 5852, then just one transaction, that there are two lastSize messages of 1, followed by a volume message of 5853.
I found the info to plug into the market data request form by rooting through some of my log files -- they have names log.Mon.txt. Another way to get the contract details could be to right click on a TWS ticker and select "contract details."
Now, try hitting "Disconnect."
A pop-up indicating that an exception occurred appears! Hit its "OK" button, then a "Connection Closed" pop-up appears. Hit its "OK" button, then another "Connection Closed" pop-up appears (there must have been two "connections"). Hit its "OK" button. Hit the "Close" button.
Next, I'll go through using the out-of-the-box API to enter and exit a position in ES. I'll also begin looking at the Java code to find out what pressing the "Req Mkt Data" button causes to happen. Another interesting thing to find out is where are the price and volume events being processed. It is when those events arrive that a bot has work to do.