Crypto Market Making Dashboard

TL’DR: A Github open source release of a Streamlit Cloud App to visualize the cumulative returns of an Avelleneda-Stoikov limit order book strategy, using the CCAPI open source market making app and exchange data pipe.

Alan Coppola
HotChili Analytics: Financial Signals
3 min readFeb 12, 2022

--

Cumulative Returns of Strategy versus Benchmark

Motivation

While working on algorithmic trading of stock market strategies, via HotChili Analytics, we’ve become enamored with the crypto exchange marketplaces that support the flow of this new asset class.

We are looking at applying Machine/Statistical/Deep Learning techniques to making markets for this arena. To this end, we want to run backtests, followed by live paper market making, an finally live realtime market making.

Different toolsets are already available to bootstrap crypto market making(CCAPI, Hummingbot, Gate.io), yet we soon decided that without visualization dashboards to aid in analysis of our new limit order book strategies, we wouldn’t get anywhere, so here is a Cumulative Returns Dashboard, that compares the cumulative returns of an example market making strategy to the buy-and-hold strategy of simply buying the mid-point of the asset at any time.

Flow

The data and code flow for this market making backtest is:

  1. Get historical exchange data for a particular pair, from a particular exchange, during a specified time frame.
  2. Run the strategy(algorithm) you have on the historical data to simulate what the exchange was doing to your account, with your strategy buying. selling, and canceling limit orders. For each day of the simulation, three exhaust files drop out of the run: a. *account-balance.csv, b. *private-trade.csv, and c. *order-update.csv
  3. Run analysis on the data. In particular, the mm_dash streamlit app plots the cumulative returns for the strategy being run, against the “buy-and-hold strategy benchmark, which simply buys and sells at the midpoint.

Example

To run the dash_mm app, you can use the demo data supplied or create your own data. We create the data from running CCAPI’s data collection program and market making app. Of course, since this app just visualizes data, you can produce the input traces files in the proper format (column labeled .csv files) using any method you like. We choose to use the CCAPI code base to scrap exchange data for asset pairs, and then run the spot_market_maker app in backtest mode to

We have collected the first two items above into a script, and the third is the focus of this article.

System Configuration

To create the data files, produced from items 1 and 2 above, and needed for this app, we will assume that you have compiled CCAPI’s spot_market_making, and have an environment like ours. We use a Ubuntu box, configured with miniconda, and enhanced with the various modules needed installed from conda-forge. For a Windows based environment, we’re now using Windows11 with wsl2.

Example Data Collection

You can either run the streamlit app on the sample data pre-stored in the github project repo, or create your own data by executing the strat-avst.sh script below on your configured box.

Script to collect exchange data, then run the strategy on it to produce backtest exhaust traces

Visualization

Finally, after we get the <exchange>__<pair>__<date__account-balance.csv files created, one for each day, as exhaust from running our strategy on the exchange data we downloaded, we’re ready to visualize the results in our StreamLit Cloud app, which is served at: mm_dashboard.

Conclusion

Use this app to visualize your Crypto Market Making Cumulative Returns, using the CCAPI backtest infrastructure.

Stay tuned for more and better visualization, followed by extensions to paper and live trading.

--

--