Decoding the Black Box running Trading Systems

7 min read

Decoding the Black Box running Trading Systems

What is a Trading System?

Before we decipher the meaning of Black Box and what Black box trading means, let us start with the basics of a trading system. A “trading system”, more commonly referred as a “trading strategy” is nothing but a set of rules, which when applied to the given input data generate entry and exit signals (buy/sell).

Although formulating a trading strategy seems like an easy task, in reality, it is not! Creating a profitable trading strategy requires exhaustive quantitative research, and the brains behind a quantitative trading strategy are known as “Quants” in the algorithmic trading world. We can define a quant as a professional employed by a quantitative trading firm who applies advanced mathematical and statistical models with the sole objective to create an alpha-seeking strategy.

By an alpha-seeking strategy, we mean a profitable trading strategy that can consistently generate returns that are independent of the direction of the overall market.

For those outside the algorithmic trading world, the work of quants and the quantitative trading strategies appear opaque and complex, hence the term “Black Box” Trading.

How do Trading Systems operate?

Any trading system, conceptually, is nothing more than a computational block that interacts with the exchange on two different streams.
  1. Receives market data
  2. Sends order requests and receives replies from the exchange.

The market data that is received typically informs the system of the latest order book. It might contain some additional information like the volume traded so far, the last traded price and quantity for a scrip. However, to make a decision on the data, the trader might need to look at old values or derive certain parameters from history. To cater to that, a conventional system would have a historical database to store the market data and tools to use that database. The analysis would also involve a study of the past trades by the trader. Hence another database for storing the trading decisions as well. Last, but not the least, a GUI interface for the trader to view all this information on the screen.

The entire trading system can now be broken down into

  • The exchange(s) – the external world
  • The server
    • Market Data receiver
    • Store market data
    • Store orders generated by the user
  • Application
    • Take inputs from the user including the trading decisions
    • Interface for viewing the information including the data and orders
    • An order manager sending orders to the exchange

What you call a Trading System is actually a CEP System

A CEP System stands for Complex Event Processing System. This lengthy term may sound very convoluted, but once you learn complex events and the components that make a CEP system, you will appreciate this clear-box system.

A complex event is nothing but a set of incoming events. These include stock trends, market movements, news etc. Complex event processing is performing computational operations on complex events in short time. The operations can include detecting complex patterns, building correlations and relationships such as causality and timing between many incoming events.

CEP systems process events in real time and this is a key feature of a CEP system. The faster the processing of events, the better a CEP system is. For example, if a trading system is designed to detect a profit-making opportunity for the next 1 second, but the time taken by the CEP system exceeds this threshold, then the trading system won’t be able to make any profits.

The CEP system comprises of four parts: a CEP engine, CEP rules, CEP WS and CEP result interface. The two primary components of any CEP system are the CEP engine and the set of CEP rules. The CEP engine processes incoming events based on CEP rules. These rules and the events that go as an input to the CEP engine are determined by the trading system (trading strategy) applied.

For a quant, the majority of his work is concentrated in this CEP system block.  A quant will spend most of his time in formulating trading strategies; performing rigorous backtesting, optimization, and position-sizing among other things. This is done to ensure the viability of the trading strategy in real markets. No single strategy can guarantee everlasting profits. Hence, quants are required to come up with new strategies on a regular basis to maintain an edge in the markets.

There are a number of popular trading systems that are widely used in current markets. These range from Momentum strategies, Statistical arbitrage, Market making etc. See our very insightful blog on Algorithmic Trading Strategies, Paradigms and Modelling Ideas to know more about these trading systems.

Order Management in Automated Trading Systems

The signals generated by an algorithmic system can be either executed manually or in an automated way. When the signals are executed in an automated manner, we can call this entire system as an “Automated trading system”.  Automation of the orders is done by the “Order Manager” module. The order manager module comprises of different execution strategies which execute the buy/sell orders based on a pre-defined logic. Some of the popular execution strategies include VWAP, TWAP etc. There are different processes like order routing, order encoding, transmission etc. that form part of this module. See our blog on Order Management System (OMS) to know more about these processes.

Risk management in Automated Trading Systems

Since automated trading systems work without any human intervention, it becomes pertinent to have thorough risk checks to ensure that the trading systems perform as designed. The absence of risk checks or a faulty risk management can lead to enormous irrecoverable losses for a quantitative firm as seen in the past. Thus, a risk management system (RMS) forms a very critical component of any automated trading system. There are 2 places where Risk Management is handled in algo trading systems:

Within the application – We need to ensure those wrong parameters are not set by the trader. It should not allow a trader to set grossly incorrect values nor any fat-finger errors.

Before generating an order in OMS – Before the order flows out of the system we need to make sure it goes through some risk management system. This is where the most critical risk management check happens. See our blog on “Changing trends in trading risk management” to know more about risk management aspects and risk handling in an automated trading system.

High-Frequency Trading Systems

Building an automated trading system involves high costs and resources. Building such a system in-house may not be feasible for some quant firms. Such firms can opt for institutional algorithmic trading platform which allow for high-frequency trading, execution and order management across equities, foreign exchange, options, and futures. These platforms allow their clients to completely control and customize their proprietary algorithms while maintaining the confidentiality of their trading strategies.

Popular Automated Trading Systems

Building an entire automated trading system can be beyond the scope of an individual retail trader. For traders who want to explore the algorithmic way of trading can opt for automated trading systems that are available in the markets on a subscription basis. A trader can subscribe to these automated systems and use the algorithmic trading strategies that are made available to the users on these systems. We have highlighted some of the popular automated trading systems in our blog, “Top Algo Trading Platforms in India”. Traders who know programming can formulate and backtest their strategies in programming platforms like Python and R.

Build Your Own Algorithmic Trading Systems

By now, you must have realized that “Black Box” trading is not as complex as it sounds.  Wannabe traders can learn to build their own algorithmic trading strategies and trade profitably in the markets. The following steps can serve as a rough guideline for building an algorithmic trading strategy:
  1. Ideation or strategy hypothesis – come up with a trading idea which you believe would be profitable in live markets. The idea can be based on your market observations or can be borrowed from trading books, research papers, trading blogs, trading forums or any other source.
  2. Get the required data – To test your idea you would require historical data. You can get this data from sites like Google finance, Yahoo finance or from a paid data vendor
  3. Strategy writing – Once you have the data, you can start coding your strategy for which you can use tools like Excel, Python or R programming.
  4. Backtesting your strategy – Once coded, you need to test whether your trading idea gives good returns on the historical data. Backtesting would involve optimization of inputs, setting profit targets and stop loss, position-sizing etc.
  5. Paper trading your strategy – After the backtesting step, you need to paper trade your strategy first. This would mean testing your strategy on a simulator which simulates market conditions. There are brokers which provide the algorithmic trading platform for paper trading your strategy.
  6. Taking your strategy live – if the strategy is profitable after paper trading you can take it live. You can open an account with a suitable broker that provides the algorithmic trading facility.
The number of exchanges that allow algorithmic trading for professional, as well as retail traders, has been growing with each passing year, and more and more traders are turning to algorithmic trading. We hope that this article was insightful for our readers and would encourage them to upgrade their way of trading. So what are you waiting for? Go Algo!!

Next Step

If you want to learn various aspects of Algorithmic trading then check out the Executive Programme in Algorithmic Trading (EPAT®). The course covers training modules like Statistics & Econometrics, Financial Computing & Technology, and Algorithmic & Quantitative Trading. EPAT® equips you with the required skill sets to build a promising career in algorithmic trading.


We have noticed that some users are facing challenges while downloading the market data from Yahoo and Google Finance platforms. In case you are looking for an alternative source for market data, you can use Quandl for the same.