lundi 8 octobre 2018

fastest way to share data between a C++ and Python program?

I'm trying to build a algorithmic trading program. The program has execution flow like this:

Server sends data via websocket -> Python program receives it and sends it to C++ program -> C++ program processes the data and sends some data to Python code -> Python code sends packets to Server

The reason I'm not building the whole thing in C++ is because Broker's API only supports Python and I cannot perform the operations I wish to perform fast enough if I switch to Python.

The frequency of data is going to be at least ~50kb (binary and Json) per second. So far I've found the following alternatives:

  1. Embed Python in C++ code. This seems great, but I'm not sure if would be able to import whole library and use classes/methods (broker's client) in C++.

  2. Communicate through sending packets (latency is the issue here)

  3. Put the data received in SQL database and have C++ query it every X ms. (again, latency)

Is there any better way to do this?

Aucun commentaire:

Enregistrer un commentaire