¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Google Protocol Buffers usage in the latest Java API


 

Would anyone like to comment on the introduction of Google Protocol Buffers in the Latest Java TWS API version 10.35 ?

--


 

When use of Protocol Buffers was first suggested back in 2015, I posted
some comments on IBKR's GitHub repository that were fairly critical of
the idea. If you have access to the API repository, you can see these at:





(For those who don't have access, the attached file contains the text
from these posts.)

Most of what I wrote then is still true, but one thing that has changed
is that protobuf compilers now exist for many common languages: for
example WikiPedia says this:

"Protobuf 3.0 provides a code generator for C++, Java (including
JavaNano, a dialect intended for low-resource environments),
Kotlin, Python, Go, Ruby, Objective-C, C#, PHP, Dart.[14] It
also supports JavaScript since 3.0.0-beta-2.[15]

Third-party implementations are also available for Ballerina,
[16] C,[17][18] C++,[19] Dart, Elixir,[20][21] Erlang,[22]
Haskell,[23] JavaScript,[24] Julia,[25] Nim,[26] Perl, PHP, Prolog,
[27][28] R,[29] Rust,[30][31][32] Scala,[33] and Swift.[34]"

So those who develop their own API implementations using such
languages should have no trouble making use of IBKR's protobuf work.

Those who use other languages will be in serious trouble, unless IBKR
commits long-term to allowing use of either the old protocol or the
protobuf implementation. At present, the protobuf implementation
is very limited in scope, and use is optional. But presumably the long-term
goal is to extend the protobuf implementation to all API message types,
and who knows what IBKR will insist on then?

So my overall position is that this is all a big waste of IBKR's time and
effort, for no real benefit. If they were starting to develop the API now,
use of protobuf throughout would be a no-brainer, but after decades
of development using the current protocol I'd say: it ain't broke, so
don't fix it!

Richard


 

I see in 10.35 in the C++, there is no option to ignore this ProtoBuf.? 10.35 is version 201 (MIN_SERVER_VER_PROTOBUF), and its all coded into the source.? It does not seem there is way to avoid this mistake.? Looks like 10.34 will be the max build version for some time for many of us.


 

¿ªÔÆÌåÓý

Ross

?

You¡¯re absolutely right!

?

I was too lenient in my earlier post, because after a cursory glance a couple of weeks back I had mistakenly thought that the EClient.useProtoBuf() function was a settable attribute of EClient. But of course it¡¯s not¡­

?

So it looks like I¡¯m pretty much shafted by this. One of my API implementations is actually written in Visual Basic 6 (believe it or not, lots of history there) and is still a vital component in my trading platform, but there¡¯s seems to be no chance of using protobuf in that. My other API implementation is .Net based, so there is a way forward there.

?

Oh well, life is full of surprises¡­

?

Richard

?

?

?

From: [email protected] <[email protected]> On Behalf Of rossh_yh via groups.io
Sent: 03 April 2025 17:56
To: [email protected]
Subject: Re: [TWS API] Google Protocol Buffers usage in the latest Java API

?

I see in 10.35 in the C++, there is no option to ignore this ProtoBuf.? 10.35 is version 201 (MIN_SERVER_VER_PROTOBUF), and its all coded into the source.? It does not seem there is way to avoid this mistake.? Looks like 10.34 will be the max build version for some time for many of us.


 

On this topic, I also enquired with IB about some mechanism to opt-in/opt-out protobuf, possibly via a connection option or a TWS configuration setting, but they said no.

So, even though your client can still decide whether or not to use protobuf when sending a request, TWS responses will automatically use protobuf regardless, if API version ¡Ý MIN_SERVER_VER_PROTOBUF.


 

What about the API implementations for Excel & vba? Are those affected?

Thank you

El jue, 3 abr 2025 a las 22:09, noreply.section+dev via (<noreply.section+dev=[email protected]>) escribi¨®:

On this topic, I also enquired with IB about some mechanism to opt-in/opt-out protobuf, possibly via a connection option or a TWS configuration setting, but they said no.

So, even though your client can still decide whether or not to use protobuf when sending a request, TWS responses will automatically use protobuf regardless, if API version ¡Ý MIN_SERVER_VER_PROTOBUF.


 

¿ªÔÆÌåÓý

No, the ActiveX API is a wrapper around the C-Sharp API, and this change is internal to the C-Sharp API so it won¡¯t look any different to the ActiveX code.

?

Richard

?

From: [email protected] <[email protected]> On Behalf Of joanmarcel119 via groups.io
Sent: 03 April 2025 22:31
To: [email protected]
Subject: Re: [TWS API] Google Protocol Buffers usage in the latest Java API

?

What about the API implementations for Excel & vba? Are those affected?

?

Thank you


 

Hi Richard,

I see from the documentation that python is supported by protocol buffers. Does this mean that third party APIs like ib_async are impacted by this change?

Pranav


 

Yes, Pranav. All TWS API clients that want to communicate with the capabilities of API 10.35.01 (server version 201) and higher will have to be able to send and receive protobuf formatted messages. IBKR has made those changes for all languages they support (including the IBKR Python API), but independently developed APIs including ib_async will have to add those capabilities eventually as well, or they are limited to requests, responses, and classes available in 10.34.02.

For the foreseeable future, clients that implement API 10.34.02 or below will still be able to communicate with TWS/IBGW 10.35 and above. That may be sufficient for many users for quite some time.

In API 10.35.01, IBKR has added protobuf formatted messages for the following items (though the original messages are still supported for clients with APs below 10.35):

  • one request: reqExecutions()
  • two responses: execDetails() and execDetailsEnd()
  • five classes: ComboLeg, Contract, DeltaNeutralContract, Execution, and ExecutionFilter

The classes and functionality of the request and the responses are identical to those in 10.34.02, except that ExecutionFilter in 10.35 has two new fields: the interger field "lastNDays" and the list "specificDates".

´³¨¹°ù²µ±ð²Ô

?

?
On Thu, Apr 3, 2025 at 07:20 PM, Pranav Lal wrote:

Hi Richard,

I see from the documentation that python is supported by protocol buffers. Does this mean that third party APIs like ib_async are impacted by this change?

Pranav


 

¿ªÔÆÌåÓý

Hi ´³¨¹°ù²µ±ð²Ô,

?

Many thanks. So, it appears we have some time but perhaps not to get third party frameworks up to date.

?

?

Pranav


 

It will take a while to convert over to this new API design.?? I think its a mistake to be doing this to a mature product that essentially has no new or important trading method additions pending any time soon.
?
But it does give me an opportunity to erase so much old code.? By making the next release a 10.35++ only and forcing a cutoff point, I can eliminate hundreds of? "if ServerVer > x" tests and plenty of "if ServerVer < 201" code too.
?
It would be nice to know how much of this API this ProtoBuf will eventually be applied too.? Obviously this first version is just the starting point.


 

Talking to myself here:
?
I see in 10.37, he has added 13 new proto types, and all the order place / status msg's, and a lot more, now use protobuf.? So the full conversion is being forced onto us.
?
I have built my own protobuf engine to send / recv in the most minimal way possible.? But it still takes 75 code lines per parameter to get the job done where 5 lines did it before.?? It's running in 10.35 version, but now I need to add another 13 proto type handlers.? Yipee.
?


 

You are most likely correct in that all messages will eventually be converted to Protobuf style messages. Unfortunately, IBKR does not even communicate intentions or rationales to the member of the TWS API Beta group on Github. These changes are being dropped and released with absolutely no comments.
?
I will stay at TWS API version 10.34 (server version 199) for the foreseeable future. The integration of Protobuf in versions 10.35 through 10.37 is quite disruptive and destabilizing and will introduce serious bugs. I also had no time yet to assess performance impacts. The generated serializer/deserializer code is massive, ugly, and not straight forward to read.
?
As you pointed out, more code is required to just call the Protobuf serializer/deserializer methods than the entire serializer/deserializer code for the traditional message styles. And while TWS API version 10.37 implements only four requests and a total of 21 prototypes as Protobuf messages it already adds more than 40,000 lines of code for that.
?
´³¨¹°ù²µ±ð²Ô
?
?
On Tue, May 27, 2025 at 12:40 PM, rossh_yh wrote:

Talking to myself here:
?
I see in 10.37, he has added 13 new proto types, and all the order place / status msg's, and a lot more, now use protobuf.? So the full conversion is being forced onto us.
?
I have built my own protobuf engine to send / recv in the most minimal way possible.? But it still takes 75 code lines per parameter to get the job done where 5 lines did it before.?? It's running in 10.35 version, but now I need to add another 13 proto type handlers.? Yipee.
?


 

I agree with ´³¨¹°ù²µ±ð²Ô on this one.? I tried 10.36.02 on my Linux platform to test building and running it to see what benefits I got.? I even used the latest C++ protobuf/abseil libraries and, after much headache, I didn't notice any appreciable upside; performance for my use case also dipped.? I, too, have decided to stay with 10.34 for the foreseeable future.
?
I'm looking forward to what others have learned and decided to do with it going forward.
?
?
T.