Skip to content

quedexnet/python-api

Repository files navigation

Quedex Official Python API

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

Show Me Some Code

Go straight to our Simple Trading Tutorial.

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.
  • The API is fully compatible with Python 2 and 3.

Important!

  • Next to this documentation, please read the general documentation of our WebSocket API.
  • 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@8bdde08#egg=quedex_api

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.

Getting Credentials

You'll need to create an instance of Trader to use the API (for details see Simple Trading Tutorial). Trader needs to be provided with your account id and encrypted private key - you may find them in our web application - on the trading dashboard select the dropdown menu with your email address in the upper right corner and go to User Profile (equivalent to visiting https://quedex.net/webapp/profile when logged in).

The Exchange entity needs to be provided with the URL of our API, which is wss://api.quedex.net and our public key which for your convenience is bundled with the API - just import it like so from quedex_api import quedex_public_key.

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 very welcome!

License

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