Cuemacro’s TCA software is now open sourced

It’s a difficult time at present around the world. You obviously don’t need me to tell you that. Let’s hope that we can conquer the coronavirus soon and we all give thanks for those on the front lines, working in hospitals caring for the sick, those working in supermarkets and all those keeping society going through this difficult period.

 

In the meantime, like most you reading this, I’ve been working from home. Whilst, I work independently, this is the first time I’ve been working from home for any reasonable duration of time. I’ve tried to keep myself as busy as possible during this period, in particular doing a lot of coding on tcapy. tcapy is a TCA (transaction cost analysis library), which I’ve been working on for several years. I originally wrote it for a large asset manager, and I have been planning to open source it for a long time. Over the past few weeks, I’ve been going through the code and adding lots of documentation (adding more soon). I’m pleased to announced that, as a result, tcapy is now available as an open source library to download for free from GitHub here!  Full instructions on how to install it are here. Screenshots and a more detailed description of tcapy is here.

 

tcapy is one of the first open source libraries for doing transaction cost analysis. Traditionally, the only way to get a fully flexible TCA library and to keep trade data private was to write it all yourself. This is very expensive, not only to develop, but also to maintain. The costs can easily run into hundreds of thousands of dollars (or perhaps millions), including the ongoing costs to maintain it. Furthermore, most of the time you are reinventing the wheel, because the vast majority of the code will be similar to other TCA solutions (eg. loading/caching of data) and the proprietary elements (eg. your market impact models) are likely to be only a very small part of the code you write. Plus, because no one else uses the code apart from your firm, you don’t benefit from updates due to others, which you might never have thought of. Alternatively, you could use an external TCA service, which in many cases is also expensive. This is of course easier, but you probably won’t have access to the source code, so it will be difficult to modify (you have to wait for your vendor to this). Plus you’re basically locked in. The costs can be significant. It also isn’t as transparent, given you can’t actually see the code yourself.

 

tcapy offers another way! It’s been developed over the past few years, originally for a large asset manager. It is open source, so it is fully modifiable, and hence, can be totally customised to your requirements, except, you don’t spend years building the framework. You just spend time adding your own proprietary metrics! You can also run it on your own hardware, and keep your trade data private too. Basically, it’s the best of both worlds, an easy to use solution (like external TCA), that also has the benefits of an internal solution, such as data privacy and customisation, all at a fraction of the cost. At present it supports FX spot, but with sufficient interest and support we are hoping to add other asset classes too and instruments such as FX swaps.

 

We are also hoping to add adaptors to external TCA services too (if you’re a TCA provider and want to get involved let us know!), to make it easy to access them in tcapy, so you can easily compare and contrast the results between different TCA providers. One big problem at the moment is that the TCA reports provided by different vendors and banks all look very different to one another, making comparison very difficult. Hence, tcapy will give you both internal and external TCA is one neat interface.

 

tcapy works with a number of different databases out of the box (SQL Server/MySQL/PostgreSQL/CSV for trade data and Arctic/MongoDB/KDB/InfluxDB/CSV for market data). It even comes with an adaptor to download market tick data from a free data source and you can use whatever market data you want, if it’s already in a database (or you can write your own wrappers to download from you favourite data provider). You can create queries to do TCA in a completely Pythonic way, totally independent of whatever databases you are using. There’s no more writing of database queries in proprietary languages which are unreadable after you’ve written them. Just do everything in high level Python instead, when specifying the parameters of your transaction cost analysis. Simple metrics like slippage and market impact are already implemented as well as benchmarks like arrival price, TWAP and VWAP. We’re also planning on writing a package to enable tcapy to take streaming data and dump it to a database.

 

tcapy has a web GUI interface or you can use tcapy by calling it programmatically (see this Jupyter notebook which shows you how to do this). tcapy not only gives you back pandas DataFrames with the output, but can also generate charts in Plotly directly for you to use and create HTML reports. We are working many improvements to tcapy, such as a RESTful API, an Excel interface and more granular HTML reports. We’ll also be adding lots of additional Jupyter notebooks to illustrate how to use tcapy.

 

tcapy has a lot of functionality to ensure that the computation is distributed. It uses a lot of in-memory caching to speed up the loading of data, and a lot of cool tricks to parallelise the calculations. Importantly, all technologies tcapy are open source and any closed source dependencies are optional. We are also currently working on ways of properly integrating into a cloud environment with serverless computing to allow tcapy to take advantage of massively parallel computation in the cloud.

 

If you’re interested in using tcapy and want to help support tcapy let me know. In order to fund further development of tcapy, Cuemacro offers an commercial enterprise licence, where we offer full and immediate technical support for the library. Furthermore, you can sponsor new features for us to add, such as new metrics (eg. market impact model) or speed improvements. Cuemacro can also work on consulting projects to help you integrate tcapy more easily into your current system. If you’d like to contribute to the open source library, let us know and if you have any feedback at all about tcapy.

 

It can cost hundreds of thousands of dollar to develop and maintain a TCA library! It is much cheaper to use tcapy, compared with either maintaining your own internal TCA library, or paying for an external TCA service. Save hundreds of thousands of dollars on TCA, by using open source tcapy and download it today from GitHub!