Coder Social home page Coder Social logo

pydex's Introduction

PyDEX: Python 0x Relayer

Introduction

PyDEX is a python-based DEX (decentralized exchange) which makes use of the 0x Protocol. The initial goal of this project is to deliver an out-of-the-box python implementation of the Standard Relayer API which utilizes the open orderbook relayer model, much like the typescript-based 0x-launch-kit provided by the 0x team. However, we do plan to extend this beyond just open orderbook model to a more sophisticated matching relayer model and this would take us beyond the SRA into a custom API which is yet to be designed.

Setup Instructions

Make sure you have python3 and virtualenv installed. On Mac OS you can use brew to install python3 and then pip3 to install virtualenv

brew install python3
pip3 install virtualenv

Once you have confirmed python3 and virtual env are successfully installed, install all the dependencies using:

source setup

The above script will do three things:

  1. It will fetch and install the node_modules required to run the @0x-order-watcher.
  2. It will create the pydex_env virtual environment and install the python packages required for running PyDEX.
  3. It will activate the virtualenv required for running pydex

Run Instructions

Run using script

source run-pydex

The above script will do three things:

  1. It will make sure the node and python dependencies are installed (by calling source setup)
  2. It will ensure the order-watcher server is running
  3. It will launch an instance of the pydex app at localhost:3000.

Optionally you can set the following environment variables:

  • NETWORK_ID: integer ID of network (1: MainNet, 4: Rinkeby, 42: Kovan, 50: Ganache)
  • JSON_RPC_URL: URL to your Web3 provider to be used by order-watcher-server. (Either a local ethereum node, or a public one like Infura which typically will look like https://rinkeby.infura.io/<your API key here>). If you do not set this, it will default to the local Ganache URI at http://localhost:8545.
  • PRIVATE_KEY: your private key as a hex string to be used for executing orders on the relayer's behalf. Note that this is currently not secure so do not use for mainnet deployment.

Development

Note on Contribution

While contribution to this project is highly encouraged and appreciated, I would greatly appreciate any PRs to fully adhere to the following guidelines:

  1. Make sure all tests pass
PYTHONPATH=./src ./pydex_env/bin/pytest
  1. Make sure pylint and flake8 do not show any issues by running:
PYTHONPATH=./src ./pydex_env/bin/pylint src tests
PYTHONPATH=./src ./pydex_env/bin/flake8 src tests

Hint: you can greatly reduce linting problems by making use of autopep8 which is installed as part of the dev requirements and is configured to run every time you save a file in the visual studio settings provided with this project (.vscode/settings.json)

  1. Please ensure your PR is rebased to master branch with interactive merging which squashes any useless intermediate commits. The commit comments must use imperative tense and be clear and concise.

Setting up Development Environment

First make sure the environment is active

source pydex_env/bin/activate

Then, install all the dev requirements:

pip3 install -r dev_requirements.txt

Note on using jupyter notebooks to interactively play around with pyDEX

As always, make sure the environment is active (source pydex_env/bin/activate). Then, run juputer from the ./notebooks directory using the command:

PYTHONPATH=../src jupyter notebook

Tips

If you found this project useful, and would like to tip the founders (officialcryptomaster and michaelhly) you can send ETH or other ethereum assets to the following ETH address: 0xf7A3668F8Bc40Af03579FC00bEdc31e4Cc662624 Thanks!

pydex's People

Contributors

officialcryptomaster avatar michaelhly avatar

Watchers

James Cloos avatar Aleksei Tcelishchev avatar

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.