#### Need to know

• Corporate treasuries are experimenting with machine learning tools to reduce effort, and improve the accuracy of cashflow and exposure forecasts.
• It could open the door to a fully automated hedging workflow; vendors say robo-forecasts could feed into tools that recommend and execute trades.
• For some treasurers, this feels a long way off. The first step – a big one – is to standardise data across the firm.
• For others, new tools are showing promise. One airline has improved its yen cashflow forecasting accuracy, allowing it to hedge more effectively.
• “Savings are huge,” says a director in the airline’s treasury.

Some years ago, the treasury team at a multi-billion-dollar tech company mangled a hedge of its yen exposure – selling and buying the wrong sides of the currency pair, and effectively doubling down on the existing position. It was a $100 million notional trade. “Fortunately, it went in the company’s favour, but if it had gone the other way, you can imagine more than a few people would have lost their jobs,” says a machine learning expert working in currency risk management. Today, this is a familiar anecdote of human frailty. In years to come, it may be regarded as a historical curiosity. Across a diverse range of companies, treasury teams have started experimenting with algorithms that will reduce the manual labour involved in some of their more complex, time-consuming tasks, including cashflow and exposure forecasting, and the identification and execution of risk management trades. For now, much of the work is painful and unglamorous – collecting, cleaning and standardising data – but it could usher in a razzle-dazzle future of hands-free hedging. It is not a vision everyone is sold on, because some of the obstacles – particularly the mire of company wide data standardisation – are too great for a treasury department to fix. As a senior trader at one FTSE 100 company puts it, the treasury function is “the tail that can’t wag the dog”. But it is no longer science fiction at least. Three corporates that spoke to FX Markets – sister publication of Risk.net – for this article have taken their first steps along this path, including a major European airline. ###### In the past 12 months, we’ve really seen corporates beginning to deploy some of those disruptive technologies in a little bit more of a direct and meaningful way within the treasury function Sam Hewson, Citigroup “We are looking at ways of increasing the accuracy of our cashflow forecast and artificial intelligence provides the opportunities,” says a director in the airline’s treasury and risk team. This trio is not alone. Sam Hewson, global head of e-FX solutions at Citigroup in London, says: “In the past 12 months, we’ve really seen corporates beginning to deploy some of those disruptive technologies in a little bit more of a direct and meaningful way within the treasury function.” It is not just an opportunity for the corporates themselves, of course. For companies that don’t want to hire their own data scientists and build their own tools, banks and tech vendors are offering shortcuts – but with very different business models. While vendors are chasing annual licence fees, banks hope treasurers will use their analytics and then send the resulting hedges to the bank’s trading desks. “The dealers are trying to be a one-stop shop,” says an ex-banker who worked on one of these embryonic services until his departure last year. “The hope is that if you’re using a bank’s front-end tool to identify your exposures, then you will execute more transactions with them. Hopefully you’ll put more flow their way, so you won’t necessarily be charged for using the tool itself.” But there are early, and potentially decisive, objections to relying on a third party. Some treasurers already balk at the idea of piping their data to a dealer, as they would need to for some of these tools to work. A treasury source at a German industrial giant gives the idea short shrift: “I don't think we would consider doing that.” ### Room for improvement A survey of treasury practices at 400 companies carried out by Citi last year found 58% using robotic process automation in some form. In a survey of 238 treasuries by PwC, also last year, 61% of respondents said exposure forecasting would become the most relevant application of artificial intelligence for them. In theory, another tool would pick up these forecasts and use them to identify the optimal hedge, and potentially execute the more routine transactions as well. “That’s when you move from a realm of pure efficiency and straight-through-processing into making more informed decisions using better data that technology has allowed you to both expose and interrogate,” says Hewson at Citi. “Once you understand the quantum of risk you have, you can determine how, when, how much, what product and what tenor to use when hedging that exposure or collection of exposures.” That’s the theory. And there’s certainly room for improvement in corporate FX hedging. Kyriba, a provider of cash and risk management solutions, found currency swings cost US-listed multinationals a total of$11.5 billion in revenues in the third quarter of 2019 – the fifth consecutive quarter of $10 billion-plus losses. Their European counterparts lost a relatively paltry$740 million (see figure 1).

After moving its cashflow forecasting from Excel to software that incorporates machine learning last year, the European airline has seen an improvement in accuracy, and a corresponding reduction in over- and under-hedging.

“The savings are huge. We’re talking millions of euros a year,” says its treasury director. “There used to be inaccuracy of up to 15% in our cashflow forecasting, which meant we would either hedge too much or too little of our exposures. Using a machine learning environment for cashflow forecasting in Japanese yen, for example, we are now 95% accurate.”

The company has not yet taken the additional step of automating its hedging, but the treasury director likes the idea: “Today, risk managers get the data and the analysis and, based on the mandate given by the board, go into the market and hedge the position. The question is: why don’t we do it automatically?”

### The non-wagging dog

While the future may look bright, the present is often a gloomier place. The first obstacle facing a treasury that wants to automate cashflow and exposure forecasting is the need to extract and consolidate invoice, payroll and contract data, held in various IT systems. These could include treasury management systems (TMS), enterprise resource-planning (ERP) systems, procurement systems or spreadsheets – each of which may have its own data formats.

According to Citi’s survey, 63% of corporate treasuries said their TMS was either not integrated or only partially integrated with their ERP. An ERP provides the required underlying business data to identify risk exposures, while a TMS lets finance departments automate its operations. In addition, 72% of respondents reported manual inputs as part of their forecasting process.

These obstacles are already crimping the ambitions of the FTSE 100 company. A senior trader says the firm has “started to look at ways of using machine learning to predict cashflow. However, the problem is the data is so disparate. The ability to get all that data in one place and in the right format has been a challenge.”

The firm is big enough that supporting a treasury analytics push with data scientists would not be the main problem. The issue is more fundamental, he says – achieving a group-wide data model would be both expensive and disruptive, requiring senior management to get behind it.

“Cashflow forecasting is an offshoot of the company’s businesses, and treasury is not the most important stakeholder. We are the tail that can’t wag the dog,” the trader says.

###### Cashflow forecasting is an offshoot of the company’s businesses, and treasury is not the most important stakeholder

“As and when data consolidation becomes cheaper, faster and more standard, then I think we would overlay it with analytics software. But at the moment we’re still challenged by consolidating data from so many different ERP sources on a daily basis,” adds the trader.

The do-it-yourself approach could soak up a lot of time and money.

Miquel Noguer i Alonso, founder of the Artificial Intelligence Finance Institute, an education initiative, estimates the cost for mid-size treasuries of adding a team of data scientists to be in the region of $3 million in annual salary costs alone. The machine learning expert working in currency risk management says this is conceivable, estimating data scientists could command salaries in the region of$200,000 to \$250,000 per year, and a corporate might need between two and 10 of them to design a system, which itself could take at least a year to develop.

Faced with these challenges, some treasuries are turning to banks and vendors for help. HSBC is deploying machine learning to unearth patterns in the payments and invoice data of corporate customers. Supported by a data and innovation lab in Canada, machine learning techniques are being used to analyse up to 10 petabytes of data from HSBC corporate and institutional clients.

Methods employed include ‘adaptive learning’ to spot patterns within data sets and update models accordingly to improve hedging mechanisms. HSBC did not respond when asked to provide an update on the project, first reported last year.

Citi, meanwhile, has partnered a fintech, Cashforce, to let clients experiment with new cashflow-forecasting and working capital analytics tools.

Hewson emphasises the message that data quality is critical to the use of these tools, but says banks can help: “We don’t just help in the execution; we help in data extraction, transformation and then providing connectivity solutions to our clients.”

### A sharing economy?

For corporates that choose to lean on third-party software, there is a separate obstacle – the requirement to give up a trove of invoice, payroll and contract data that could be used to power the analysis. For the German treasury source, that’s a deal-breaker, and a treasury expert at one fintech agrees it is “difficult to convince corporate clients to give access to their ERP, where you will have the invoices and payroll that will impact the cashflow”.

Difficult is not the same as impossible though. Trading and risk analytics firm Finastra is upgrading its Fusion Kondor system for FX and money market trading to include a service leveraging big data and AI.

The idea is to enable bank users of the system to recommend hedges in particular to their own small- and medium-sized enterprise (SME) clients, but the service depends on the willingness of those SME firms to hand over their data, says Jean-Baptiste Gaudemet, treasury and capital markets solutions architect at Finastra.

###### For SMEs, our ultimate goal is to make it fully automated
Jean-Baptiste Gaudemet, Finastra

“That means banks will need to make sure there is a sufficient incentive for the corporate to share the maximum amount of data with the bank – that by sharing more data with the bank, clients will get a better rate,” he says.

Gaudemet adds: “For SMEs, our ultimate goal is to make it fully automated. First, the needs of the clients would be anticipated by forecasting cashflow, and there would also be a good understanding of client risk appetite. Then we would offer an Amazon-like approach where the SME clients receive recommendations via a mobile app for foreign exchange hedges they can execute on.”

A willingness to share data could benefit all parties, argues Leonardo Orlando, capital markets analytics and innovation expert at Accenture – and former deputy treasurer at helicopter manufacturer AgustaWestland. In theory, the corporate gets to protect its revenues through superior hedging while the bank attracts more business. This mutually beneficial scenario is then only a short step away from hands-free hedging.

“It’s up to the corporate to take a decision around whether they want to put a trading robot on top of the cashflow AI to do auto-hedging,” says Orlando.

Those who take that extra step would also need to set thresholds on minimum amounts of transaction exposures, identify any currencies they wouldn’t want to hedge, and define how to net hedging on naturally offsetting positions, he notes.

If this kind of set-up becomes widespread, it will open the door to an even bigger change, where corporate treasurers’ forecasting and hedging algorithms could be connected with each other through some form of ledger – an AI-powered peer-to-peer netting facility that would slash the participants’ need to hedge with the wider market.

“If one bank needs to sell US dollars and another needs to buy US dollars within the same timeframe, they can exchange US dollars between them and avoid additional fees. That is what we envisage as the future for corporates, as well as possibly using blockchain. But they must first become less averse to introducing new digital technology and sharing their data,” says Orlando.

### How would treasurers use AI?

Forecasting cashflow involves interrogating multiple sub-entities for their contribution to the forecast rollup, and then adjusting the data based on past experience of accuracy (writes Ashley Groves, CEO of Deaglo, a cross-border foreign exchange advisory firm).

Combining sub-forecasts into a durable group-level forecast is required to calculate the tenors and notionals of an FX hedging program. Inaccurate forecasts result in over- or under-hedging, sometimes incurring extra costs and always increasing risk. The number of variables that can affect a cashflow forecast is enormous. Using current methods, corporate treasuries must focus on the largest factors, often ignoring the macro situation.

Machine learning/AI can cut through the chaff, and improve the accuracy of forecasts by analysing extremely large databases and quantifying relationships that are not understood a priori. In the context of cashflow forecasting, identifying and correcting inaccurate sources – as well as quantifying the impact of macro events – can be achieved given sufficient data.

Data for machine learning algos needs to be sourced from many economic cycles and as many relevant sources as possible. It’s best to include everything that is likely – if it isn’t relevant, the algorithm will figure it out. Every data set has bad or missing data, duplicates and typos that must be corrected before use – then it must be uniformly formatted.

More time will be spent cleaning data than analysing it. Data also needs to be dimensionally reduced to improve the performance of machine learning algos. This rationalisation can be accomplished through techniques such as scaling, principle component analysis, aggregation and attribute sampling.

As cashflow forecasting and hedging is an ongoing process, this is not a ‘one and done’ activity. Thought must be given to how data will be stored and used – in a data warehouse or lake.

#### Analysis

Moving on to analysis, machine learning techniques can be grouped according to the type of problem being solved.

#### Classification (figure 2)

Given a specific set of characteristics, what category does a particular instance belong to? This could be used to make distinctions between strong and weak prospects, and good or bad credit risks. The usual algos include kernel approximation, linear support-vector machines (SVC), k-nearest neighbour or naive Bayes.

#### Regression (figure 3)

While classification selects from a specific solution set, regression is a continuous mathematical representation. Where linear SVC might be used to classify prospects into two groups (good or bad), regression would assign a numeric score. It estimates and quantifies the relationship between a dependent variable and any number of independent variables. As figure 3 shows, a good use of regression would be to investigate the efficacy of a currency proxy versus target currencies. Common algos include stochastic gradient descent regression, lasso, ridge regression and Bayesian regression.

#### Clustering

This is used to group a larger set of objects into sets when a set’s members are more similar to each other than members of other groups. Recognising sub groups or communities within a larger population has numerous uses, including in medical imaging. Treasurers could apply it when identifying fraudulent activity or in document analysis to group text into different themes. Unlike classification, where groupings are known ahead of time, with clustering, such attributes are not known in advance.

Common algos used include k-means (figure 4), Gaussian mixture models, spectral clustering and density-based clustering.

The next stage is to divide the data into training and testing sets. The algo will be trained using the training set, and then the model will be tested by feeding it the test data that it has not seen yet. This approach can be further refined using ‘k-fold’ cross-validation techniques and, depending on the algorithm, model parameters can be tweaked.

It is best to select several models to test their efficacy. Models usually offer metrics on how well they are able to fit the data, and once the best-performing model has been found it can be put into operation and evaluated against the old methodology for several quarters.

Only users who have a paid subscription or are part of a corporate subscription are able to print or copy content.

To access these options, along with all other subscription benefits, please contact [email protected] or view our subscription options here: http://subscriptions.risk.net/subscribe

#### Regulation

###### Duffie: SEC plan heralds all-to-all Treasuries trading

You need to sign in to use this feature. If you don’t have a Risk.net account, please register for a trial.

##### You are currently on corporate access.

.

Alternatively you can request an individual account here: