Why create an open source FX TCA library?

20180223 Open source FX TCA

The idea of transaction cost analysis (TCA) has been around for years. As the name suggests, it is analysis that can be done to understand how much you are paying for your trading. At its simplest level, it can involve calculating the slippage between the market mid and your executed price. If we are doing FX TCA, for the market mid, you would likely want quoted prices, which can be aggregated from many platforms such as EBS, Thomson Reuters, Hotspot, banks platforms or a ready made aggregate like New Change FX’s benchmark. We can also compare market impact (how much does the price drift after an order?) and many other metrics. We can compare transaction costs across different currency pairs and in particular to compare brokers. MiFID II has also made it important for traders to be able to show to got best execution for their clients. We would argue though that even without MiFID II, understanding the cost of your trading is still very important. Indeed, an inability to understand transaction costs can render what appears to be a very successful trading strategy in backtesting, end up loss making.

 

What are the platforms we can use to do FX TCA?

 

The question is how can we do FX TCA? Here are two typical approaches below:

 

  • create your own FX TCA library internally – this will be very flexible
  • use an external FX TCA service – upload your trades to the cloud and get back analysis (or run the software locally)

 

Developing your own FX TCA library can be very costly and time consuming. However, it will be very flexible. You can use whichever metrics you want as well (and change them as you’d like) and feed it whatever data you want, including your own quote streams at times, which you can collect or externally collected data. Using an external service by contrast is a lot easier. Some services also give you the option of comparing your performance with your peers. However, some asset managers might not be comfortable with giving out their entire trade history to an external party (admittedly, this concern can be removed, if the vendor allows you to run the software locally or if the vendor is an independent company). Ultimately though, the only way to get full transparency is to have access to the code itself.

 

Is there another way, which provides you with the flexibility of having you own FX TCA library internally which can be modified and also not having to develop something like that from scratch? In particular, can we focus our time on developing the proprietary elements, rather than reinventing the wheel, in terms of the framework? Can we still get full transparency from a FX TCA library which we don’t code from the ground up? Yes, and the answer is open source!

 

An open source FX TCA library is the answer!

 

I’ve been working on an FX TCA library written in Python over the past few months, parts of which I am hoping to open source. I’ve specifically focused on FX TCA, to leverage my market experience of well over a decade in currency markets. Whilst some of the calculations in an FX TCA library can be proprietary, especially for certain metrics, the bulk of the calculations which go on are relatively generic which can be open sourced. Furthermore, the whole idea of TCA is that it is supposed to be transparent. The best way to ensure transparency is to allow the user to have access to the code to see precisely what is going on. Also being written in Python it should make it accessible to a wider audience to modify it.

 

This FX TCA open source library provides a simple generic framework, for users to modify or create their own FX TCA metrics and run accordingly. It can be the case that you might want to create very specific and proprietary metrics for measuring your brokers performance. By creating the framework, I’m dealing with the nuts and bolts of the problem (getting data in, creating a nice GUI etc), freeing up time for traders to think about the analysis at hand, rather than low level APIs. Furthermore, under the hood, I’ve used a lot of tips and tricks to ensure that the library is fast. I’ve used parallel computation to do this (which can be distributed across multiple machines) along with some use of in-memory data caching, and some old-fashioned code profiling to identify specific speed bottlenecks.

 

So how do I plan to fund the open source project? There are several ways. I’m hoping to support it through sponsorship, in particular at the initial stages, which is the most common way for open source projects to get funded. I have already open sourced several other Python libraries including finmarketpy, one of the most popular Python based backtesting libraries on GitHub, with over 1700 stars, giving me experience in how to establish a community open source project.

 

Why should a bank, fund or a data firm sponsor this open source FX TCA project?

 

Even if a bank or fund already has its own TCA platform, supporting an open source FX TCA platform will foster community interest in this problem. It is likely that the community will contribute new metrics and approaches to the library. It’s an effective way to crowdsource ideas. Maybe the crowd will produce a metric you haven’t thought of trying before? It’s also an effective way to show that your company is a supporter of open source software. Open source isn’t just for folks like Google and Facebook, we can do it in finance too! A data company could sponsor the project to fund the inclusion of FX data APIs in the project for their own market data. This will encourage users to get access to your dataset.

 

So what next?

 

At present I have an early working demo of the open source FX TCA library and potential sponsors can contact me to view this demo. I am hoping to have the whole open source Python library available in the summer, provided I can get sufficient sponsorship. The plan is that I’ll also offer commercial support for the library, as well as more proprietary metrics, which will be only available on a commercial basis and this will help to support the project on a longer term basis. However, the bulk of the project will be available to download for free on an open source basis on GitHub.

 

Conclusion

 

It is important to know how much your transaction costs are. An open source FX TCA library gives you the best of both worlds, the customisation element with some of the convenience of a pre-built product. It also offers full transparency too. If you’re interested in making this idea happen, drop me a message! It’s time there were an open source library for FX TCA, let’s hope we can get it done soon!