Contribute Media
A thank you to everyone who makes this possible: Read More

Developing a real-time automated trading platform with Python


Miguel Sánchez de León Peque - Developing a real-time automated trading platform with Python [EuroPython 2016] [18 July 2016] [Bilbao, Euskadi, Spain] (

Nowadays Python is the perfect environment for developing a real-time automated trading tool. In this talk we will discuss the development of: a general-purpose multiagent-system module using Pyro and ZeroMQ; a platform, based on it, for developing automated trading strategies using Numpy, Numba, Theano, etc.; and a GUI for visualizing real-time market data using PyQtGraph and Qt.

In OpenSistemas we have developed a general-purpose multi-agent system which is written in pure Python: osBrain. Agents communicate with each other using ZeroMQ, allowing the user to define different communication patterns based on their needs.

Based on this multi-agent system, we have also developed a broker- independent platform for real-time automated trading: osMarkets. This platform implements specialized agents:

  • Feeder is an agent which receives real-time data from the broker.
  • Router is an agent which receives data from feeders. It manages the historical data and distributes updates to all the subscribed agents in the network.
  • Brain is the most common agent. It receives data from router or from other brains and processes them, sending the results to other brains or sending orders to be executed. Brains can make use of many useful packages avilable in the Python ecosystem: NumPy, SciPy, Numba, Theano...
  • Trader is an agent which is designed to interact with the broker, just as the feeder, but to execute market orders.
alternate text

While it is still in its earliest stages, we are developing a tool for real-time visualization of trading strategies using PyQtGraph. This tool acts as an agent in the multi-agent system.

alternate text
Improve this page