Backtesting C++ Algorithms

What software is available for backtesting trading algorithms written in the C++ programming language? I would not like to use an online service such as Quantopian or Quantconnect (they don’t offer C++ support regardless).

Are there any libraries or applications that can be used for this?

• Is my understanding correct that you're looking for a C++ library for creating back tests? – Bob Jansen May 24 '18 at 15:34
• @BobJansen Yes that’s what I’m looking for. – ofey73 May 24 '18 at 18:51
• Quantopian uses zipline (github.com/quantopian/zipline), which is the only open source backtester that I know of. – steveo'america May 25 '18 at 19:25

I developed my own backtesting system for multiple tickers in C++, maybe some of these ideas may help.

Storage: I store every ticker's data into a binary file (one file per ticker), ordered by timestamp. Any other kind of storage (CSV files, SQLITE database), ordered by timestamp will do, for the purpose of backtesting.

Backtesting: I create a priority queue in memory (priority given by timestamp), then I read a single tick from each of the ticker's files and put them into the priority queue, then I start consuming the ticks from the priority queue, lowest timestamp first. Every time I consume a tick, I read another tick from the file from which that tick came out, and put it into the priority queue. In this way I can also simulate a delay for orders going to the market: every time the strategy I'm backtesting generates an order, I put an "order tick" with a delayed timestamp into the priority queue, and I simulate actual execution only when that order tick is consumed from the queue.

• Would you happen to have any of this on GitHub or anywhere else for us to look at and alter for what we need? Thanks. – ofey73 Jun 14 '18 at 5:29
• The code is messy and in continuous refactoring and the comments are in Italian unfortunately, anyway here it is the backtesting part of my code if you think you can find it useful: github.com/enricodetoma/backtesting It can't be compiled in the present form, because too many other classes are missing, but anyway it should give you an idea of what I wrote in my answer – Enrico Detoma Jun 14 '18 at 7:33
• Thanks, I appreciate it. Will take a look, potentially a new project. I know some Spanish and Google crudely translates Italian to English so I’ll see how I do. – ofey73 Jun 14 '18 at 15:19
• I haven't yet decided whether to open source the whole project, being difficult for me to maintain it alone. Or at least share it with a group of contributors. In case I decide that way, I would translate all italian comments before publishing it. – Enrico Detoma Jun 14 '18 at 18:20
• CQG and IQFEED should be ok for real-time tick data, just to name two. I used CQG. Now I'm using data from an Italian broker for Eurex – Enrico Detoma Sep 6 '18 at 8:54