Coder Social home page Coder Social logo

wtp's Introduction

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
  • SundaeSwap

Dex 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=<number> - Return mean swap price for tokens. Mean is not AVG, but ration on the pool address
  • /asset_swap/TOKEN1_ID/TOKEN2_ID?count=<number> - 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:

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:

ln -s ../../pre-commit.sh .git/hooks/pre-commit

How to modify the database schema

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

# Ideal run parametres for WR
cargo run -- --socket localhost:3001 --database $DATABASE_URL --persistent  --start 57270168:17a26b5607a6f61fe89bf73a7a242ff4fa6dd6c667f3b2d6fc56bbcad644e90b

wtp's People

Contributors

davidmisiak avatar michalvido avatar miksax avatar priner avatar

Watchers

 avatar  avatar  avatar  avatar

wtp's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.