Your Account  •  Become a Member  •  Help  •  Search    
    Forums ›› Technically Speaking ›› Automated Trading ›› IB TWS API Speed  


Post A Reply
    Page 1 of 2:   1  2  
Maharaja
 

Registered: Feb 2004
Posts: 373

 

11-03-09 10:38 PM

Working with the TWS API in java I have noticed that my processing of market data in making a trading decision is fairly quick (few millis). But actually creating an IB order and placing it is taking much longer, around 3-20 millis. Has anyone experienced this type of behavior? What I mean is instantiating a new Order object and then sending the order in via EClientSocket is taking a long time. How can this be sped up? Can it be sped up?

Also, does anyone have any suggestions as to how to increase performance of both the trader workstation and custom application that makes use of the TWS API? Are there any jvm settings that can be made that optimize performance? Any specific linux settings or networking settings that can help with performance?

I've been playing around with the "nice"-ness (in linux) of the two applications but I haven't really measured the performance gains. I just assumed there would be... :-)

On another note, how fast is the IB market data compared to other vendors? How does the latency compare?

Thanks in advance for any suggestions...

    Edit/Delete • Quote • Complain
TrailingStop3
 

Registered: May 2008
Posts: 106

 

11-03-09 10:53 PM

Hi Maharaja,

I have not recognized any new lag in speed of the TWS, but I use C++ to access the TWS interface. To speed up the over-all-performance I have put the complete communication from and to the TWS in a separate thread with non-blocking read and write access to the socket. This turns out to be the right way since I never run into any speed problems related to the interface to the TWS. Since IB provides only 'snapshots' of the market the latency is not a big issue. The number of quotes to transfer will not increase that much as it does for other providers in fast markets.

Daniel

    Edit/Delete • Quote • Complain
dcraig
 

Registered: Jun 2003
Posts: 1558

 

11-03-09 11:07 PM


Quote from Maharaja:

Working with the TWS API in java I have noticed that my processing of market data in making a trading decision is fairly quick (few millis). But actually creating an IB order and placing it is taking much longer, around 3-20 millis. Has anyone experienced this type of behavior? What I mean is instantiating a new Order object and then sending the order in via EClientSocket is taking a long time. How can this be sped up? Can it be sped up?

Also, does anyone have any suggestions as to how to increase performance of both the trader workstation and custom application that makes use of the TWS API? Are there any jvm settings that can be made that optimize performance? Any specific linux settings or networking settings that can help with performance?

I've been playing around with the "nice"-ness (in linux) of the two applications but I haven't really measured the performance gains. I just assumed there would be... :-)

On another note, how fast is the IB market data compared to other vendors? How does the latency compare?

Thanks in advance for any suggestions...



I think you misunderstand what nice is intended to do. It really means "be nice to others". ie if you have a process that is hogging CPU increase the nice value so that other processes get more of a fair go.

As for Java performance, you might try a server JVM. I think that they are more inclined to do the JIT thing after fewer code iterations than the workstation variant. Garbage collection is significantly different though.

In any case does 10ms really make much of a difference? It is likely to be swamped by internet latencies, broker latencies (margin checking, order routing etc) and exchange processing etc.

    Edit/Delete • Quote • Complain
rwk
 

Registered: Dec 2003
Posts: 721

 

11-03-09 11:08 PM

I know there are some TWS buffer settings that you can increase provided that you have plenty of memory available. I cannot remember where I read about it, and a quick search turned up nothing. I recommend searching the two most active discussion groups:
http://finance.groups.yahoo.com/group/TWSAPI/
http://www.interactivebrokers.com/smf/

You might also email tech support @ tac@interactivebrokers.com

[rwk]

    Edit/Delete • Quote • Complain
Maharaja
 

Registered: Feb 2004
Posts: 373

 

11-04-09 12:48 AM


Quote from rwk:

I know there are some TWS buffer settings that you can increase provided that you have plenty of memory available. I cannot remember where I read about it, and a quick search turned up nothing. I recommend searching the two most active discussion groups:
http://finance.groups.yahoo.com/group/TWSAPI/
http://www.interactivebrokers.com/smf/

You might also email tech support @ tac@interactivebrokers.com

[rwk]



Is this what you are talking about?

http://individuals.interactivebroke...p?ib_entity=llc

"If an API application intends to make historical data requests that return more than 1000 bars, it is recommended that TWS be configured to increase the sizes of the API socket buffer. This can be done in the "tws.xml” file in the user’s Jts directory. It is important that TWS not be running when its tws.xml file is manually modified. In the XML element, the elements can be used for this purpose. Modifying that entry in the element in tws.xml ..."

    Edit/Delete • Quote • Complain
rwk
 

Registered: Dec 2003
Posts: 721

 

11-04-09 12:53 AM


Quote from Maharaja:
Is this what you are talking about?
http://individuals.interactivebroke...p?ib_entity=llc


That's probably it.

    Edit/Delete • Quote • Complain
    Page 1 of 2:   1  2  
Post A Reply


Receive an email whenever a new post is added to this thread by subscribing to it.
Rate This Thread:

Forum Jump:
 

 

   Conduct Rules  •  Privacy Policy Copyright © 2009, Elite Trader. All rights reserved.    
 
WHILE YOU'RE HERE, TAKE A MINUTE TO VISIT SOME OF OUR SPONSORS:
Alpari (US)
US Forex Trading Services
AMP Trading
Futures and FX Trading
Bright Trading
Professional Equities Trading
Cyborg Trading
Gray-Box Trading Tools
CTS
Futures Trading Software
ECHOtrade
Professional Trading Firm
Equity Trading Capital
Equity & Option Training
eSignal
Trading Software Provider
Global Futures
Futures, Options & FX Trading
Go Futures
Online Futures Trading
Interactive Brokers
Pro Gateway to World Markets
Interbank FX
Foreign Currency Trading
JC Trading Group
Direct Access Trading
Keystone Trading Group
Prop Trading Firm
MadScan
Trading Software Provider
MB Trading
Direct Access Trading
Mirus Futures
Commodity Trading Services
NinjaTrader
Trading Software Provider
OneChicago
Electronic Futures Exchange
Questrade
Brokerage for Canadian Traders
Rithmic
Futures Trade Execution Platform
SpeedTrader
Direct Access Trading
SpreadProfessor
Spread Trading Instruction
thinkorswim
Direct Access Trading
TickQuest
Trading Software Provider
TradeMaven
Software and Education
TradersStudio
Trading Software Provider
TradeStation
Direct Access Trading
Trading Technologies
Trading Software Provider
Trend Following
Trading Systems Provider
Velocity Futures
Derivatives Trading Services
Zumo
Futures and Options Trading