/python-api

Primary LanguagePythonApache License 2.0Apache-2.0

Quedex Official Python API

The best way to communicate with Quedex Bitcoin Derivatives Exchange using Python.

Why Is This Cool?

  • The API hides all technical concerns (transmission, encryption, serialization, threading and connection) from the user so that all programming efforts may be concentrated on trading logic.
  • We provide classes for easy integration with Twisted which is one of the best frameworks for programming network communication in Python. Twisted uses asynchronuous input/output which makes our API quite fast.
  • Simple Trading Tutorial is written in literate programming style and translates to simple_trading.py script which is a ready-to-run example of using the API. The same file is also used in API's end-to-end test.

Important!

  • All prices (offers, trades, quotes) are expressed in BTC per USD rather than the opposite (which is the case on most of the other exchanges and our web application). For details, see Inverse Notation on our website.
  • Quedex Exchange uses an innovative schedule of session states. Some session states employ different order matching model - namely, Auction. Please consider this when placing orders.

Getting the API

To use the API in your Python project include the following in your requirements file (when installing with pip):

-e git+https://github.com/quedexnet/python-api.git@664e7db#egg=quedex_api
-e git+https://github.com/SecurityInnovation/PGPy.git@e183c68#egg=PGPy

PGPy has to be temporarily included as a commit from the master branch and is not included as a dependency of the API, because the current version 4.0.1 does not deliver all the required functionality.

Documentation

The fastest way of getting to know the API is by looking at the Simple Trading Tutorial. It shows how to set everything up using Autobahn on top of Twisted, listen for exchange events and how to send trading commands. If you prefer working with bare code, you can take a look at examples/simple_trading.py (it is generated from the tutorial).

Documentation of the API can be found in the code (mostly in MarketStream and UserStream classes). Integration with Twisted is implemented in UserStreamClientProtocol and MarketStreamClientProtocol classes.

The API is designed to be flexible and may be used with various implementations of WebSockets (other than Twisted). To this end, use MarketStream and UserStream with the WebSockets library of your choice. UserStreamClientProtocol and MarketStreamClientProtocol can be used as a reference on how to integrate MarketStream and UserStream classes with a WebSockets library.

Contributing Guide

Default channel for submitting questions regarding the API is opening new issues. In cases when information disclosure is not possible, you can contact us at support@quedex.net.

In case you need to add a feature to the API, please submit an issue containing change proposal before submitting a PR.

Pull requests containing bugfixes are wery welcome!

License

Copyright © 2017 Quedex Ltd. API is released under Apache License Version 2.0.