Ivy Schmerken
Ivy Schmerken

Machine learning stirs up competition in FX Algo Trading

By crunching vast quantities of data by computer, machine learning algorithms can identify hidden patterns in past data and learn to forecast stock market returns or FX currency pairs. Large banks have been investing millions into advanced technologies

Though capital markets firms have been adopting artificial intelligence and machine learning to train algorithms for equity trading, recently this trend has expanded to foreign exchange. Ivy Schmerken, Editorial Director at Flextrade Systems, has written widely about this topic and we asked her to revisit it for e-Forex.

By crunching vast quantities of data by computer, machine learning algorithms can identify hidden patterns in past data and learn to forecast stock market returns or FX currency pairs. Large banks have been investing millions into advanced technologies such as AI and machine learning to capture a bigger share of the algo trading market. 

JP Morgan developed a new algorithm dubbed DNA – or Deep Neural Network for Algo Execution to merge what a multitude of algos do into a single strategy, allowing the framework to decide how a client’s order should be executed, reported Reuters in “How to train your machine: JP Morgan FX algos learn to trade better.”

“DNA is an optimization feature that leverages simulated data from various types of market conditions to select the best order placement and execution style designed to minimize market impact,” said Chi Nzelu, Head of Macro eCommerce on Aug. 8 2019  in a post on JP Morgan’s web site. 

“What we have done is establish a neural network using a machine learning technique which determines how to place the order, at what price and execution style,” JP Morgan’s Nzelu told Reuters. To create an algorithm that is an enhancement for certain existing strategies, the strategists behind DNA used reinforcement learning, a subset of machine learning, to assess the performance of individual order placement choices. By using deep pools of data that simulate multiple market scenarios reinforcement learning trains the algo to learn from the actions it takes. 

According to the bank, this is a fundamental shift from early generation algos, which were primarily built off human-based programming or rule-base executions.

Machine learning
By using deep pools of data that simulate multiple market scenarios reinforcement learning trains the algo to learn from the actions it takes

“Machine learning is a natural next step of algorithmic trading because machine learning identifies patterns and behaviors in historical data and learns from it,” said Robert Hegarty, managing partner, Hegarty Group, a consultancy focusing on financial services, technology, data, and AI/machine learning. 

While traditional algorithms are created by programmers and quant strategists, these algorithms based on if/then rules do not learn on their own; they need to be updated. “With machine learning, you turn it over to the machine to learn the best trading patterns and update the algorithms automatically, with no human intervention,” said Hegarty. “That’s the big differentiator.”  

The evolution of machine learning is migrating from equities to other liquid asset classes. “Machine learning is following a very similar path to electronification of markets and the advent of algorithmic trading,” said Hegarty. “If you look at the path of electronic markets, it has started in equities and moved over to FX and on-the-run Treasury bonds. Now with machine learning, it’s very much the same,” he said.  

Any market that has a lot of liquidity, publicly available data, and the need for speed and a way to profit from that, is a ripe candidate for electronic trading, algorithmic trading, and now AI, said Hegarty. 

For instance, JP Morgan’s DNA has been implemented for trading highly liquid G-7 currencies, such as the dollar, euro, and Sterling, where the algo has access to data on thousands of past trades.

As the largest and most liquid asset class, about 78% of volume in FX is traded electronically, slightly down from a high of 79% in 2017, according to research firm Greenwich Associates.  Banks are using machine learning to improve the performance of algorithms they develop for asset managers and hedge fund clients.

A recent study of the global foreign exchange market showed that FX algo usage has been slower to gain traction than in other asset classes. Only 37 percent of buy siders use FX algorithms, and this accounted for about 22 percent of the volumes conducted by FX, according to Greenwich. 

ML adapts to volatile markets

The momentum behind machine learning is getting more attention with the volatility caused by the global pandemic. Experts suggest that models built with machine learning are faster, more complex, and can adjust to extreme events, such as surge in volatility precipitated by the COVID-19 outbreak.

“It’s about building a trading venue that can adapt to a changing environment,” said Roman Ginis, CEO of Imperative Execution, a startup which launched IntelligentCross, the first AI-enabled alternative trading system for equities in 2018.  
After each trade, the ATS — which matches orders at discrete times, microseconds to milliseconds apart — measures how much the price moved and incorporates it as a data point into its AI system. It then recalibrates the match times to keep the price movement as close to zero as possible, while maximizing liquidity.

Machine learning
The concept of a broker-neutral randomization tool is not new. But prior to the Algo Wheel, such “switchers“ and “allocators“ lacked the “big data“ analytics.

During the height of the pandemic in March, the combination of AI and machine learning enabled IntelligentCross to handle the explosion in volatility and volumes.

For example, when volatility increases, order patience decreases – the faster the market moves the less time orders tend to rest. “IntelligentCross adapts to order rates and order patience, Venues that don’t or can’t adapt, exhibit worse performance when the environment changes:  they either manifest worse market impact, or worse liquidity,” said Ginis.

Major banks serving as electronic market makers are utilizing machine learning to carry on dealing in volatile FX markets. 

When currency markets struggled with flash crashes in 2018, precipitated by algorithms that shut down as volatility spiked, UBS used machine learning technology to continue dealing, reported Reuters.

UBS Orca-Direct learns in real time by using historical trading data to find the best available liquidity for the bank’s clients when volatility increases, wrote Reuters in “UBS looks to machine learning to plug FX liquidity gaps.”  Introduced to a limited set of clients in 2018, ORCA-Direct helped volumes in the bank’s algorithmic FX business double in 2018, and earned UBS the ranking of fastest-growing FX algo broker by market share from the second to the fourth quarter from Boston Consulting Group and benchmark firm Expand, according to Reuters.

But traditional investment banks are not the only ones diving into AI and machine learning. Fintech providers are investing in these advanced technologies to optimize their processes. 

Article Image

Alistair Cree

Algo Wheels and ML

One of the use cases for machine learning in trading is making transaction cost analysis (TCA) actionable for the buy side by assessing the performance of different broker algorithms. For example, reinforcement learning is used by FlexTrade within its algo wheel to help the wheel adapt over time based on the results of the data that the algo wheel generates, said Alistair Cree, Product Manager for TCA, Analytics and Algo Wheels at FlexTrade.  

To illustrate the point, say a buy-side firm traded 50% of its orders with broker A and 50% with broker B and received some performance data back. “One of the problems encountered when running an algo wheel is deciding on how to re-weight the wheel based on the performance of the different destinations and the number of orders in your data set.” 

Historically, the approach was to do nothing and then take one big leap and reweight the wheel, said Cree. `

 “Reinforcement learning will say, given the performance of these two destinations and given the amount of data it has, it needs to re-weight by this small amount. Because that entire solution is entirely automated, you can make, many small incremental steps, rather than doing nothing and then taking one giant leap,” said Cree.

“Rather than spending three-to-six months just collecting data, and not using any of the data that you have to improve performance you’re able to improve performance continuously over that period,” said Cree. 

Cloud-based Ecosystem 

Now machine learning’s momentum has a lot to do with technology advancements in GPUs (graphic processing units), parallel processing, and big data. “This reflects the convergence of cloud capability, the proliferation of data and the advances in AI and machine learning models,” said Hegarty. 

Today the tools are readily available. Amazon, Google, and Microsoft have “fantastic cloud-based platforms for training machine-learning models that can be rented for a fraction of the cost of building it out in-house,” said Roman Ginis of Imperative Execution.
There are hundreds of open-source machine learning models, like Google’s TensorFlow and eXtreme Gradient (XG) Boost, which are all built so solve slightly different problems, depending on the types, whether it’s a classification or regression problem, or whether supervised, unsupervised or reinforcement learning best suits the use case, said Hegarty. Each of these models are built to handle different problem solving, he said.

Some firms have developed artificial neural networks, a regression model, which like the human brain, receives data inputs and sends data outputs across many nodes, said Michael Mollemans, Research Principal at Chartis Research. Those nodes have extra layers of variables and coefficients which keep updating as the data comes in, said Mollemans.
JP Morgan’s DNA is one type of artificial neural network, motivated by biological neural networks of the human brain. “They are capable of modeling complex non-linear relationships with little restriction in the inputs, which is useful when trading to model reality because relationships in real life are often complicated,” stated Sam Nian, a Lead Strategist in the DNA initiative.

Machine learning
Major banks serving as electronic market makers are utilizing machine learning to carry on dealing in volatile FX markets

Banks are also competing with nimble startups that have backgrounds in quantitative trading and machine learning. Boston-based A.I. Capital Management is using an AI-generated trading approach based on deep reinforcement learning to trade the major FX US dollar (USD) currency pairs.  Working on the AlphaFX project since 2016, the firm’s founders were inspired by Google DeepMind’s AlphaGo project, which is a deep reinforcement learning agent that beats human Go world champions.  
Deep reinforcement learning combines a deep neural network with a reinforcement learning algorithm, according to the firm. This turns sequential tasks into a Markov process whereby the AI agent interacts with the environment via action, getting rewards, improving on its future actions to reach a better environment.  
In a video on its web site, the firm shows how its AI trader learns to trade EUR/USD before and after 1 million steps of trading. Before the training, the agent is randomly placing trades and losing money; after the agent is trained on 1 million steps, it learns to trade intelligently, and its total reward is positive.

But AI-enabled financial algos need to be complex to perform well and are not necessarily intuitive to understand. One of the biggest challenges is that the AI-trained algos tend to perform well on “in sample” anonymous test data, only to find their predictability doesn’t hold up when fed the real world, out of sample data, wrote Mollemans. This can happen due to overfitting the model’s variables to the data. Quants at A.I. Capital Management say they built their product Alpha FX A.I. on institutional ECNs and achieved “great” out-of-sample risk-adjusted returns for the past five years across 26 currency pairs. Now the firm is scaling its trading effort to create a fund. 

While machine learning and AI are making inroads into currency markets, this is only the beginning of an evolving process. If anything, machine learning will become more pervasive on trading desks as firms build algos that learn from their own actions. One of the challenges is explaining these strategies to the institutional clients and gaining acceptance, while assuring them that humans are still in charge.