Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vacuumlabs/wtp
Carda DEX swap feed
https://github.com/vacuumlabs/wtp
cardano dex oura postgres price rust seaorm
Last synced: about 2 months ago
JSON representation
Carda DEX swap feed
- Host: GitHub
- URL: https://github.com/vacuumlabs/wtp
- Owner: vacuumlabs
- Created: 2022-09-29T08:47:54.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-04T00:38:07.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T04:11:29.196Z (8 months ago)
- Topics: cardano, dex, oura, postgres, price, rust, seaorm
- Language: Rust
- Homepage:
- Size: 236 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# What the price
Tool for Cardano to get Dex SWAP operation, store it to the Database and broadcast it through the WebSocket.## DEXes
We have implemented 3 Dexes
* WingRiders
* MinSwap
* SundaeSwapDex can have more versions and more addresses per version.
## Interface
* `/health` - Health check endpoint
* `/assets` - List of assets present in the database. This is a place, where pair asset_id with name and policy
* `/exchange_rates` - Calculate exchange rate. There is no information about decimal numbers
* `/mean_history/TOKEN1_ID/TOKEN2_ID?count=` - Return mean swap price for tokens. Mean is not AVG, but ration on the pool address
* `/asset_swap/TOKEN1_ID/TOKEN2_ID?count=` - Return last swap price for tokens.
* `/socket/` - WebSocket endpoint for Live information about the swap.## Setting up
Run a Postgres instance and create an empty database for this project:
```bash
export DATABASE_URL='postgres://postgres:postgres@localhost:5432/wtp'
psql -U postgres -c 'CREATE DATABASE wtp;'
cargo migrate up
cargo run -- -s 'relays-new.cardano-mainnet.iohk.io:3001' -d $DATABASE_URL
```## Development
Add pre-commit hook:
```bash
ln -s ../../pre-commit.sh .git/hooks/pre-commit
```### How to modify the database schema
```bash
cargo install sea-orm-cli
sea-orm-cli migrate generate "your_migration_name"
# now edit the new migration file in ./migrations/src
cargo migrate up
sea-orm-cli generate entity -o src/entity
```## Run
```bash
# Ideal run parametres for WR
cargo run -- --socket localhost:3001 --database $DATABASE_URL --persistent --start 57270168:17a26b5607a6f61fe89bf73a7a242ff4fa6dd6c667f3b2d6fc56bbcad644e90b
```