This library implements the algorithm described in this paper. See this paper's abstract for a brief introduction.
- Install the Haskell build tool Stack
- Run the following commands:
git clone https://github.com/runeksvendsen/order-graph.git
cd order-graph/
stack setup
- Install external dependencies
sudo apt-get install build-essential libgmp3-dev zlib1g-dev
- Build CLI executable:
stack build
-
Grab a cup of coffee
-
Run CLI executable:
stack run -- <CLI arguments go here>
For example, to see the buy/sell liquidity of bitcoin in terms of US Dollars at 5% slippage using the small test data file test/data/run1-1.json
, run the command:
stack run -- -n usd -c btc -s 5 --analyze test/data/run1-1.json
which will output:
Order book file test/data/run1-1.json
Market (base/quote) BTC/USD
Maximum slippage 5%
buy liquidity 18,050,706 USD
sell liquidity 16,228,938 USD
SUM 34,279,645 USD
-----------------------------------------------------
Input order books can be fetched using the WriteTestData
executable from crypto-venues.
- Testing:
- For all cryptocurrency/numeraire/run: liquidity as a function of slippage is monotonically increasing