Skip to content

Latest commit

 

History

History
65 lines (46 loc) · 1.53 KB

README.md

File metadata and controls

65 lines (46 loc) · 1.53 KB

pricing-server

About

This tool imports history of swap transactions from Substrate node into relational database and provides HTTP API for quering last pricing info.

Usage

  1. Clone repository
git clone https://github.com/sora-xor/pricing-server
cd pricing-server/
  1. Create .env file with DB connection settings:
cat > .env <<EOF
DB_NAME=sora
DB_USER=sora
DB_PASSWORD=secret
EOF
  1. Run all services
docker-compose up

This will start Substrate Node, PostreSQL and Web server and will start importing swap history in background.

  1. Web server with pricing data will be available at http://localhost/

http://localhost/graph - GraphQL API

http://localhost/pairs/ - Pricing data of all pairs

http://localhost/pairs/{BASE}-{QUOTE}- Pricing data for specific pair. For example: http://localhost/pairs/VAL-XOR/

http://localhost/healthcheck - Healthcheck endpoint. Returns 200 OK. Can be used to check if web server is running and accepting connections.

Running tests

python -munittest  # in project directory

Troubleshoot

When certain block are not being processed or no blocks at all then most likely there is a missing or invalid type definition in the custom_types.json

Use update_custom_types.py to update custom_types.json

python update_custom_types.py

Also, you can use the query.py file to debug type errors. It can be run with:

cd harvester
python -m pip install -r requirements.txt
python query.py

System requirements

8GB RAM 10GB free disk space