title: fastest way to share data between a C++ and Python program?
body: <p>I'm trying to build a algorithmic trading program. The program has execution flow like this:</p>
  
  <pre><code>Server sends data via websocket -&gt; Python program receives it and sends it to C++ program -&gt; C++ program processes the data and sends some data to Python code -&gt; Python code sends packets to Server
  </code></pre>
  
  <p>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. </p>
  
  <p>The frequency of data is going to be at least ~50kb (binary and Json) per second. So far I've found the following alternatives:</p>
  
  <ol>
  <li><p>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++. </p></li>
  <li><p>Communicate through sending packets (latency is the issue here)</p></li>
  <li><p>Put the data received in SQL database and have C++ query it every X ms. (again, latency)</p></li>
  </ol>
  
  <p>Is there any better way to do this? </p>