Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Mock orderbook

Anxo Rodriguez edited this page Aug 7, 2020 · 2 revisions

Sometimes is useful to visualize some examples orders in the order book

The following project allows creates a mock endpoint that can be consumed by the web: https://github.com/nlordell/dex-pg

The data for the orderbook is defined in human readable way.

fees = standard # can be standard (default), none, double, buyer, seller

token ETH  id 1
token USDC id 4 decimals 6

order buy 1   ETH  for 395 USDC
order buy 600 USDC for 1.5 ETH

Run the service

You'll need Docker for next steps:

git clone https://github.com/nlordell/dex-pg
cp orders.example order
docker build . -t dex-pg
docker run -it --rm -p 7000:8080 -v "$(pwd):/root:z" dex-pg

Edit your custom config

Make sure you edit only you local custom config. Read more here.

Add the following to your config

dexPriceEstimator:
  type: 'dex-price-estimator' # choices: dex-price-estimator
  config:
    - networkId: 1
      url_production: http://0.0.0.0:7000/
      url_develop: http://0.0.0.0:7000/

Edit the orders

Edit the file ./orders in dex-pg

Restart the web

Restart the web and go to http://localhost:8080/trade/WETH-USDC or http://localhost:8080/book

Clone this wiki locally