Python Algorithm Trading – The 4 Basic Elements

Creating a python algorithm for trading means that one must cover four basic building elements. Market data, order processing, tracking/analysis, and backtesting. These four elements are all required to build a successful trading strategy.

1: Market Data

Market data is the price information coming from the markets. It is the last trade, the bid price, the ask price. It also is statistical information about the prices, such as moving averages, high price and low price. Market Data is highly proprietary and guarded by the exchanges. One must have a proper license to see this data.

Algorithms utilize market data to make investment decisions. Algorithms need access to historical market data and to real time, reliable market data once the algo begins trading.

2: Order Processing

When you send an order to the stock market there is a lot of steps that need to happen. Credit, sometimes called buying power, needs to be checked. The trading account needs to be validated as open. The price needs to be checked for reasonability. The transaction must be properly recorded. This all happens in the Order Management System (OMS).

Once the OMS sends the order to the exchange, then the exchange will attempt to match the order to someone on the other side. The order may remain unfilled. It may also be partially filled or fully filled. The exchange communicates all this information to the OMS. The OMS is responsible for keeping you, the trader, informed of all state changes.

Algorithms utilize the OMS to keep track of positions and order status in both backtesting and in live trading.

3: Tracking and Analysis

That which is measured gets better. That which gets measured and reported upon gets better faster.

Python algorithm trading is ideally set up to allow you to measure your performance. After all, python is widely used by data scientist for measuring, quantifying, and visualizing data. Tracking and Analysis is best done in the planning stage to iteratively improve you quantitative trading strategy. It is also necessary for tracking your performance to once live trading begins.

4: Backtesting

Backtesting provides a way to evaluate your trading strategy based upon historical data to estimate the how the strategy would perform. Historically this has only been possible within large financial institutions with access to large data sets, and computer infrastructure. CloudQuant is breaking that mold and using modern cloud technology to level the playing field.

Backtesting involves using historical market data, OMS simulators, and Tracking/Analysis to simulate trading over time.

The fifth element (with apologies to Bruce Willis)

Capital is the fifth element. You can’t trade without money.

This is where any programmer or data scientists needs the most help. Many people can write algos. Fewer can write an OMS. Even fewer have the cash reserves to purchase the historical market data. And even fewer have a robust backtesting engine.

CloudQuant is using a revolutionary business model. They are making the 4 basic elements free for anyone to use. AND we are providing access to capital. We will assign capital to your trading algo if it is profitable.