Backtesting for FX options

It’s been a while since things were normal, however, in some parts of the world things are slowly opening up. Travel has begun to open up around the world. I thought it would be worth taking advantage of this to travel myself. Some things haven’t changed, like flight delays, queues etc.! Other things clearly have changed, notably, requirements related to doing COVID tests, filling in passenger location forms etc. However, for the most part, I’m still very glad that I did travel. I certainly appreciated the ability to travel a lot more now than I did in the past, when perhaps, we all took it for granted. 

 

Just as we might try to understand the present (and the future) in how we travel, by looking at the past, we do the same in financial markets. Backtesting is an invaluable tool to understand how markets have behaved in the past and in particular for understanding how a specific trading strategy would have performed in the past. Obviously, the difficulty with financial markets is that they are non-stationary, in other words their characteristics can change, and hence, a backtest cannot be our only guide for whether we should run a trading strategy. We also need to be confident that our hypothesis is likely to persist in the future. In some cases, it is obvious that a certain hypothesis or rationale for a trading strategy won’t work in the future (eg. trying to trade markets now using tweets from Trump). However, in other cases, it might not be so clear.

 

One of the key components of backtesting, before we even come to deciding what our active trading signal is, is making sure that we have modelled the P&L of the underlying asset from a passive perspective. In other words, if we were long only (or short only) how much money would we have made. Once we know that, we can overlay our active signal, which can keep changing (whether long or short) on top of it. For some asset classes the construction of total returns can be relatively straightforward, for others it can be much more involved. You can save time by using precalculated total return indices produced by index providers and banks in many instances. However, in some cases, you might want the flexibility to construct your own ones, because you might to have control over how you roll contracts etc.

 

I did a thread on Twitter recently on backtesting FX options and I thought I would expand on it here. For backtesting FX options, creating total return indices requires a few steps. We first need to assemble all the market data, ie. FX spot data, forwards/rates data and FX volatility surface data, which we can use for valuing FX options. Unlike in equities, FX options tend to be OTC (although there are some listed FX options on CME), so we need to price the options, rather than taking prices directly from the market. We need to decide which FX option we’ll trade and also the various rolling rules we’ll employ. Let’s say we’ve decide to go persistently short EURUSD 2M ATM straddles as our benchmark, and we’ll roll 5 working days before the end of each month. If we are using daily data, we’ll need to mark the option to the market every day. On the first day, it’ll be a standard ATM option with a 2 week tenor. However, as we roll (excuse the pun!) closer to expiry, the tenor will get shorter and won’t necessarily be trading ATM. Hence, we shall need to interpolate the implied vol from the vol surface. Our options P&L can then be calculated from changes in the option value.

 

On top of that, if we also want to delta hedge our option position, we need to work out our delta hedging P&L. This will also be dependent on which delta hedging strategy we employ. Do we for example flatten our delta daily at the close or do we have some sort of threshold? Do we do intraday delta hedging (which would clearly require intraday spot data too)? We also need to add transaction costs to our options P&L when entering positions and for delta hedging in the spot market. Only once we have the options P&L and delta hedging P&L, can we then do the fun stuff, namely overlaying our active signal. We need to be careful when calculating our active strategy P&L, not to necessarily 

 

In my finmarketpy open source Python backtesting library, I’ve created implementations for total return indices, for FX spot, FX forwards and FX vanilla options, and examples to show how to run them. With finmarketpy you can specify how you want to roll your FX vanilla option etc.

 

Backtesting is an important part of creating trading strategies, but for us to do it, we need first to model the P&L without our active signal to create total return indices. It’s not really something which is proprietary, but it can be a hassle to implement and I hope some of my open source libraries can help folks to backtest their own (proprietary!) trading strategies.