Marc Angelos

How A.I. meets FX Algo trading

May 2019 in Algo Tech

As A.I. spreads across currency trading algos, their impact on execution performance is transforming firms, individuals and the market itself. But how do A.I. algos really work in FX.

The global currency market now exceeds $5 trillion-a-day in executed notional value. 80% of that total turnover is electronically traded.  And this is still increasing. Some bulge brackets have recently reported volume records for algo orders executed as a percent of total spot turnover. Trading platform EBS estimates that 70% of its order flow now originates from algorithms.

Algorithms and computerized modeling have played a growing role in the foreign exchange markets over the past decade. But something has changed. A more advanced generation of A.I. algorithms are now leveraging machine-learning and predictive analytics in a whole new manner. And this approach has quickly become the new frontier of FX trading.

Machine-learning essentially translates the “art” of trading into the “math” of data

Machine-learning essentially translates the “art” of trading into the “math” of data

Machine-learning can now leverage real-time data to make very accurate short-term predictions. Thus, these new tools are proving quite adept at the formerly manual tasks such as:

  • Selecting trade-entry/exit points.
  • Minimizing short-term volatility-risk
  • Calculating the optimal, intra-day order types.
  • Initiating earlier liquidation of losing positions
  • This new generation of A.I. algorithms is squeezing valuable intelligence from previously unmanageable mountains of data. And as these tools spread across the industry, they are impacting not just the traders in the market but the FX market itself.

Big Data

The currency market is the most liquid market in the world. Such massive liquidity powers the growing efficiency of data-driven investing – something that the quant-funds have long recognized. And that quant technology has made large-scale advancements over the past few years.

Today’s A.I. strategies can now leverage vast amounts of historic data as a reference-point in identifying real-time market-movements. This means these algos can now spot opportunities that were never previously recognized. For example, the “Big Data” approach is enabling a better understanding of true market depth around visible bids and offers. A.I. algos can proficiently isolate movement of orders up and down the order book to better identify hidden liquidity. Additionally, it can pinpoint the precise moment that liquidity begins to decline – thus offering better protection during unanticipated volatility events.

The core challenge of FX algo development has always been something called “parameter optimization” and the difficulty of selecting and weighting the ratio of algo inputs

The core challenge of FX algo development has always been something called “parameter optimization” and the difficulty of selecting and weighting the ratio of algo inputs

Most currency traders are familiar with Warren Buffet’s “Two Rules of Investing”:

1) Never lose money
2) Never forget Rule 1

Algos embedded with A.I are now making it easier for anyone to adhere to Mr. Buffett’s sage advice.

Parameter Optimisation

Data-driven tools for FX trading have proliferated for years. But the pace of change has ratcheted higher with the accelerating advancements in neural network technology. Predictably, the early adopters of this technology approach have been the quants.

Quantitative trading has become a growing focus of all asset classes over the last few years, as “best execution” has taken center-stage. Alongside all other global markets, currency traders have witnessed quant deployment of a wide variety of FX algorithms. Years of back-testing and tweaking brought varying degrees of success. However, there was never any “silver bullet” because of ONE major issue that plagues all algos.

The new generation of FX algorithms utilize a reinforcement-learning approach to the order-planning

The new generation of FX algorithms utilize a reinforcement-learning approach to the order-planning

The core challenge of FX algo development has always been something called “parameter optimization.” This is a fancy way of explaining the difficulty of selecting and weighting the ratio of algo inputs. The more of these “state variables” that any algorithm reviews in its “universe,” the more effective that algo will become in calculating likely probabilities – at least theoretically.

As you know from real life, the devil is always in the details.

Marvel fans are familiar with Jarvis’ admonition to Tony that “there are still terabytes of calculation required before an actual flight.” FX algos are no different. There are scores of factors that must be considered – and hundreds that should be considered.

Any FX trader would understand the obvious ones such as Volume, Volatility and Spread. But it gets more granular with characteristics such as the submitted size, current fill ratios, percent-of-order sent passively and time-remaining-until-order-end. Then there are things like Bid/Ask sizes as relative to the parent order and the volume since the start of the order – both current AND historical. How aggressive is the pricing? How much quantity is sent passively? And what is happening in the broader marketplace?

In a nutshell, an algo must piece-together some understanding of where the currency “should” be trading, at every moment of the day. This exercise is precisely where data-comparison against historical norm can become profound. Because any deviations can then be weighted for adjustment. This is the handoff where the baton passes from predictive analytics into machine-learning via neural networks.

Constraint based

FX algorithms must continually weigh the tradeoff between risk and cost. In that regard, they are no different from humans.

But since they lack “trader’s intuition,” algorithms were traditionally built with rigid parameters to keep them from going “off the rails.” We all understand why this was necessary. But it resulted in those traditional algorithms becoming “constraint-based.”
For example, they were usually programmed to:

  • Always respect urgency (based on volume-participation).
  • Always prioritize passive trading.
  • Always prioritize hidden/dark liquidity
  • Always focus on spread-capture

On the surface, these all seem reasonable.

Yet every trader knows that there is no such thing as “always” in the FX markets. Thus, such constraints can often end up hindering execution performance. And yet this was a necessary evil. Traditional algos needed these built-in rules because they could not make situational decisions.

….until now

Reward Function

The new generation of FX algorithms abandons this constraint-based approach. Instead, they utilize a reinforcement-learning approach to the order-planning. In other words, the A.I. can actually “decide” things such as when to send parent-orders and when to NOT send. This has become a key attribute of them. Because every trader knows that sometimes NOT trading is indeed the best move.

But how do these new FX algos actually learn?

These A.I. algos are assigned a “reward-function” that identifies the optimal outcome – for example, beating VWAP.  The algo is not told how to achieve this outcome. It just knows its end goal – and when it receives ‘sub-optimal” results from any interim action (or inaction) on the way to this. Recognizing its progress, it then does more (or less) of this-or-that. So the use of a “reward function” now replaces the scheduled-participation underlying the previous generation of “analog algos.” The use of a reward-function enables the A.I. algo to quickly learn that nebulous tradeoff between its current trading and its ultimate market-impact. Here is where copious amounts of data become relevant.

These FX algo models are “trained” on millions of (actual) previous orders, that can equate to billions of (actual) notional value traded. The models are trained offline – but with actual execution data. When their performance has been optimized to a satisfactory level they are brought live. Once deployed into the currency market, they henceforth learn in real-time. And this ongoing “training” in daily, live-market situations, continues into perpetuity.

Factors and Variables

A.I. algorithms with machine-learning capability are already live and spreading across the FX marketplace. Traders know this. Yet most don’t have a clear understanding of how these programs actually “view” real-world trading.

The A.I. algos focus on four governing “factors” in the live marketplace:

  • Current order characteristics
  • Historical order characteristics
  • Stock-specific characteristics
  • Current market environment

Through these four “lenses,” an A.I. algo will select a sub-set of the “state variables.” These are the relevant criteria it must review, moment-by-moment. There may be hundreds of variables it could consider. Yet the A.I. sifts them for only the most relevant ones at the time. In other words, it doesn’t vet against all state variables at all times. The specific ones it chooses are based on the four governing factors above.

Once the A.I. algo knows how to measure its current trading situation, it will understand its optimal course of action via probability. To be clear, this does not always result in the best trading outcome. But the machine isolates its choice with the highest chance of a “good” outcome, based on past experience.

But that’s not the end of it. Because its immediate trading result then goes back into the hopper, thus honing its decision-making for the next time around. Like you, it gets “smarter” with experience.

Volatility removal

Machine-learning essentially translates the “art” of trading into the “math” of data and then back again. The advent of predictive analytics and neural network capabilities has paved the way for this. And it is currently helping FX traders gain a huge advantage, they did not previously have.

In fact, A.I. algorithms are becoming so widespread, that they are now actually beginning to reduce overall volatility in the currency market itself. This is a by product of the algos inherent removal of human emotion and reactionary panic. Objective data-points and trend-expectation are exerting a moderating effect upon a previously unruly marketplace.

The Future

Any technology advancement always stokes an element of fear among people. Some analysts warn that 40% of all global workers may be impacted by A.I. within the next 15 years. But transformative automation is not confined to currency trading. This is happening in every industry, worldwide.
Yet there is no denying its newfound effectiveness in the FX business.

Nikkei recently used A.I. to predict Dollar-Yen exchange rates for an approaching 4-week window. As it turned out, the A.I. prediction was closer to the eventual valuation than the company’s top analysts had estimated. Indeed some studies have A.I. predicting correct values 77% of the time over a 7 day period. Such algorithms are thus informing short-term FX strategies with real-time data for very effective results.

Thus, the effectiveness of A.I. algos in the FX world continues to grow. And the folks who understand the technology – and learn to master these strategies – will benefit. Because the opportunity is massive. And the winners will be those who know how to best leverage its power.

Make sure that’s you.