Go to file
Michael Huang 135c770dcf
Changes for pypi release (#44)
* Adjustments for pypi release

* Remove if else

* Fix typo

* Revert "Remove if else"

This reverts commit 9beb895e56b4e9fa9d9a0b597671486afc84c072.

* Restore queue.py

* Revert "Restore queue.py"

This reverts commit d868475b0059d5d8c1c62132d9d031524e85729b.

* Restore event_queue_binary

* Restore other stuff

* Update README.md

* Fix version

* Address feedback
2020-10-01 10:37:32 -05:00
.github/workflows Changes for pypi release (#44) 2020-10-01 10:37:32 -05:00
.vscode Set up repo 2020-08-29 17:28:24 -05:00
notebooks Changes for pypi release (#44) 2020-10-01 10:37:32 -05:00
pyserum Changes for pypi release (#44) 2020-10-01 10:37:32 -05:00
scripts Upgraded to v2 layout. (#43) 2020-09-30 10:05:07 +08:00
tests Changes for pypi release (#44) 2020-10-01 10:37:32 -05:00
.codecov.yml Set up code coverage (#38) 2020-09-19 19:09:40 -05:00
.flake8 Set up repo 2020-08-29 17:28:24 -05:00
.gitignore Remove serum-dex dependency from integration tests (#30) 2020-09-13 21:49:18 -05:00
.pydocstyle Set up repo 2020-08-29 17:28:24 -05:00
.pylintrc Added Market Structure. (#8) 2020-08-31 20:52:51 +01:00
LICENSE Initial commit 2020-08-29 16:47:19 -05:00
Makefile Changes for pypi release (#44) 2020-10-01 10:37:32 -05:00
Pipfile Changes for pypi release (#44) 2020-10-01 10:37:32 -05:00
Pipfile.lock Changes for pypi release (#44) 2020-10-01 10:37:32 -05:00
README.md Changes for pypi release (#44) 2020-10-01 10:37:32 -05:00
docker-compose.yml Remove serum-dex dependency from integration tests (#30) 2020-09-13 21:49:18 -05:00
pytest.ini Set up repo 2020-08-29 17:28:24 -05:00
setup.py Changes for pypi release (#44) 2020-10-01 10:37:32 -05:00

README.md

ActionsStatus Codecov

PySerum

Python client library for interacting with the Project Serum DEX.

Get Started

from pyserum.connection import conn
from pyserum.market import Market

cc = conn("https://api.mainnet-beta.solana.com/")
market_address = "5LgJphS6D5zXwUVPU7eCryDBkyta3AidrJ5vjNU6BcGW" # Address for BTC/USDC

# Load the given market
market = Market.load(cc, market_address)
asks = market.load_asks()
# Show all current ask order
print("Ask Orders:")
for ask in asks:
    print("Order id: %d, price: %f, size: %f." % (
          ask.order_id, ask.order_info.price, ask.order_info.size))

print("\n")
# Show all current bid order
print("Bid Orders:")
bids = market.load_bids()
for bid in bids:
    print("Order id: %d, price: %f, size: %f." % (
          bid.order_id, bid.order_info.price, bid.order_info.size))

Market Addresses in Main Net

The source of truth of the market address can be found here. Feel free to open a PR if the following addresses needs modification or addition.

Development

Setup

  1. Install pipenv.
brew install pipenv
  1. Install dev dependencies.
pipenv install --dev
  1. Activate the pipenv shell.
pipenv shell

Format

make format

Lint

make lint

Tests

# Unit tests
make unit-tests
# Integration tests
make int-tests

Using Jupyter Notebook

make notebook

Start Serum in Docker image

./scripts/bootstrap_dex.sh

This will start a docker container with solana image and deploy a serum DEX which you can use for testing.

The market address, program id, and wallet addresses can be found in the new crank.log file after the script runs successfully.