• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

how to connect a Java-coded algo with a C++ API?

Joined
6/3/17
Messages
5
Points
13
Hi, I only know Java and have an algo coded in Java. Been using it with Interactive Broker but I am switching broker to one that only offers a C++ api. I will continue to receive feed from IB but would like to route orders to the new broker via its API. How can I have my Java program communicate with the broker C++ API?
 
Hi, I only know Java and have an algo coded in Java. Been using it with Interactive Broker but I am switching broker to one that only offers a C++ api. I will continue to receive feed from IB but would like to route orders to the new broker via its API. How can I have my Java program communicate with the broker C++ API?
Painful, indeed.
You could decide to learn C++ (and/or port Java code) and the problem is solved? C++ and Java is like oil and water.

//
thinking out loud
AFAIK IB has a C# interface; C# can interface to C++ via C++/CLI.
Maybe the Java - C# mapping is a bit easier?
 
Last edited:
Hi, I only know Java and have an algo coded in Java. Been using it with Interactive Broker but I am switching broker to one that only offers a C++ api. I will continue to receive feed from IB but would like to route orders to the new broker via its API. How can I have my Java program communicate with the broker C++ API?
google for JNA. In the old days, people used something called JNI that was painful.
 
Hi, I only know Java and have an algo coded in Java. Been using it with Interactive Broker but I am switching broker to one that only offers a C++ api. I will continue to receive feed from IB but would like to route orders to the new broker via its API. How can I have my Java program communicate with the broker C++ API?

Perhaps a tool like Swig (Simplified Wrapper and Interface Generator) can help.
 
So you guys are basically saying, I am putting myself in a craphole by switching to a C++ API broker with my Java coded system? As I see most brokers only offer C++ API (besides notably Interactive), all their traders program in C++ to connect? Generally, without knowing C++, I cannot use the api?
 
Maybe learning c++ is the way?
Not necessarily, but it might be best in the long term. You can't change IB, but you can change your own code.

Analogy: you buy an old house; do you spend the next 20 years tweeking it or do you flatten it and start again?

But it can be a bit mind-numbing and not to everyone's taste. It is a bit like maintaining legacy code.
 
Back
Top