This tool imports history of swap transactions from Substrate node into relational database and provides HTTP API for quering last pricing info.
- Clone repository
git clone https://github.com/sora-xor/pricing-server
cd pricing-server/
- Create
.env
file with DB connection settings:
cat > .env <<EOF
DB_NAME=sora
DB_USER=sora
DB_PASSWORD=secret
EOF
- Run all services
docker-compose up
This will start Substrate Node, PostreSQL and Web server and will start importing swap history in background.
- 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.
python -munittest # in project directory
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
8GB RAM 10GB free disk space