Vexbi Python Library
====================

|Coverage Status| |Build Status| |PyPI version|

Python library for `Vexbi <https://www.vexbi.com/>`__ API. Please read
our `documentation <#>`__ for instructions on how to start using the
API.

Requirements
------------

-  Python 2.7.0+
-  Git 1.7.0+

Getting started
---------------

install dependencies:
~~~~~~~~~~~~~~~~~~~~~

::

    pip install -r requirements.txt

Usage
-----

#create\_order
~~~~~~~~~~~~~~

/v2/orders
~~~~~~~~~~

***POST***
''''''''''

**Summary:** Create a Sell/Buy order. **Description:** Create a Sell/Buy
order.

**Parameters**

+-------+-------------+--------------+-----------+-------+
| Name  | Located in  | Description  | Required  | Schem |
|       |             |              |           | a     |
+=======+=============+==============+===========+=======+
| marke | formData    | Unique       | Yes       | strin |
| t     |             | market id.   |           | g     |
|       |             | It's always  |           |       |
|       |             | in the form  |           |       |
|       |             | of xxxyyy,   |           |       |
|       |             | where xxx is |           |       |
|       |             | the base     |           |       |
|       |             | currency     |           |       |
|       |             | code, yyy is |           |       |
|       |             | the quote    |           |       |
|       |             | currency     |           |       |
|       |             | code, e.g.   |           |       |
|       |             | 'btcusd'.    |           |       |
|       |             | All          |           |       |
|       |             | available    |           |       |
|       |             | markets can  |           |       |
|       |             | be found at  |           |       |
|       |             | /api/v2/mark |           |       |
|       |             | ets.         |           |       |
+-------+-------------+--------------+-----------+-------+
| side  | formData    | Either       | Yes       | strin |
|       |             | 'sell' or    |           | g     |
|       |             | 'buy'.       |           |       |
+-------+-------------+--------------+-----------+-------+
| volum | formData    | The amount   | Yes       | strin |
| e     |             | user want to |           | g     |
|       |             | sell/buy. An |           |       |
|       |             | order could  |           |       |
|       |             | be partially |           |       |
|       |             | executed,    |           |       |
|       |             | e.g. an      |           |       |
|       |             | order sell 5 |           |       |
|       |             | btc can be   |           |       |
|       |             | matched with |           |       |
|       |             | a buy 3 btc  |           |       |
|       |             | order, left  |           |       |
|       |             | 2 btc to be  |           |       |
|       |             | sold; in     |           |       |
|       |             | this case    |           |       |
|       |             | the order's  |           |       |
|       |             | volume would |           |       |
|       |             | be '5.0',    |           |       |
|       |             | its          |           |       |
|       |             | remaining\_v |           |       |
|       |             | olume        |           |       |
|       |             | would be     |           |       |
|       |             | '2.0', its   |           |       |
|       |             | executed     |           |       |
|       |             | volume is    |           |       |
|       |             | '3.0'.       |           |       |
+-------+-------------+--------------+-----------+-------+
| price | formData    | Price for    | No        | strin |
|       |             | each unit.   |           | g     |
|       |             | e.g. If you  |           |       |
|       |             | want to      |           |       |
|       |             | sell/buy 1   |           |       |
|       |             | btc at 3000  |           |       |
|       |             | usd, the     |           |       |
|       |             | price is     |           |       |
|       |             | '3000.0'     |           |       |
+-------+-------------+--------------+-----------+-------+
| ord\_ | formData    | The type of  | No        | strin |
| type  |             | order, can   | (defaults | g     |
|       |             | be           | to        |       |
|       |             | ``market``   | ``limit`` |       |
|       |             | or ``limit`` |           |       |
+-------+-------------+--------------+-----------+-------+

**Responses**

+--------+----------------------------+
| Code   | Description                |
+========+============================+
| 201    | Create a Sell/Buy order.   |
+--------+----------------------------+

#delete\_order
~~~~~~~~~~~~~~

/v2/order/delete
~~~~~~~~~~~~~~~~

***POST***
''''''''''

**Summary:** Cancel an order. **Description:** Cancel an order.

**Parameters**

+--------+--------------+--------------------+------------+-----------+
| Name   | Located in   | Description        | Required   | Schema    |
+========+==============+====================+============+===========+
| id     | formData     | Unique order id.   | Yes        | integer   |
+--------+--------------+--------------------+------------+-----------+

**Responses**

+--------+--------------------+
| Code   | Description        |
+========+====================+
| 201    | Cancel an order.   |
+--------+--------------------+

#clear\_all
~~~~~~~~~~~

/v2/orders/clear
~~~~~~~~~~~~~~~~

***POST***
''''''''''

**Summary:** Cancel all my orders. **Description:** Cancel all my
orders.

**Parameters**

+-------+-------------+--------------+-----------+-------+
| Name  | Located in  | Description  | Required  | Schem |
|       |             |              |           | a     |
+=======+=============+==============+===========+=======+
| side  | formData    | If present,  | No        | strin |
|       |             | only sell    |           | g     |
|       |             | orders       |           |       |
|       |             | (asks) or    |           |       |
|       |             | buy orders   |           |       |
|       |             | (bids) will  |           |       |
|       |             | be           |           |       |
|       |             | canncelled.  |           |       |
+-------+-------------+--------------+-----------+-------+

**Responses**

+--------+-------------------------+
| Code   | Description             |
+========+=========================+
| 201    | Cancel all my orders.   |
+--------+-------------------------+

#get\_orders
~~~~~~~~~~~~

/v2/orders
~~~~~~~~~~

***GET***
'''''''''

**Summary:** Get your orders, results is paginated. **Description:** Get
your orders, results is paginated.

**Parameters**

+-------+-------------+--------------+-----------+-------+
| Name  | Located in  | Description  | Required  | Schem |
|       |             |              |           | a     |
+=======+=============+==============+===========+=======+
| marke | query       | Unique       | Yes       | strin |
| t     |             | market id.   |           | g     |
|       |             | It's always  |           |       |
|       |             | in the form  |           |       |
|       |             | of xxxyyy,   |           |       |
|       |             | where xxx is |           |       |
|       |             | the base     |           |       |
|       |             | currency     |           |       |
|       |             | code, yyy is |           |       |
|       |             | the quote    |           |       |
|       |             | currency     |           |       |
|       |             | code, e.g.   |           |       |
|       |             | 'btcusd'.    |           |       |
|       |             | All          |           |       |
|       |             | available    |           |       |
|       |             | markets can  |           |       |
|       |             | be found at  |           |       |
|       |             | /api/v2/mark |           |       |
|       |             | ets.         |           |       |
+-------+-------------+--------------+-----------+-------+
| state | query       | Filter order | No        | strin |
|       |             | by state,    |           | g     |
|       |             | default to   |           |       |
|       |             | 'wait'       |           |       |
|       |             | (active      |           |       |
|       |             | orders).     |           |       |
+-------+-------------+--------------+-----------+-------+
| limit | query       | Limit the    | No        | integ |
|       |             | number of    |           | er    |
|       |             | returned     |           |       |
|       |             | orders,      |           |       |
|       |             | default to   |           |       |
|       |             | 100.         |           |       |
+-------+-------------+--------------+-----------+-------+
| page  | query       | Specify the  | No        | integ |
|       |             | page of      |           | er    |
|       |             | paginated    |           |       |
|       |             | results.     |           |       |
+-------+-------------+--------------+-----------+-------+
| order | query       | If set,      | No        | strin |
| \_by  |             | returned     |           | g     |
|       |             | orders will  |           |       |
|       |             | be sorted in |           |       |
|       |             | specific     |           |       |
|       |             | order,       |           |       |
|       |             | default to   |           |       |
|       |             | 'asc'.       |           |       |
+-------+-------------+--------------+-----------+-------+

**Responses**

+--------+------------------------------------------+
| Code   | Description                              |
+========+==========================================+
| 200    | Get your orders, results is paginated.   |
+--------+------------------------------------------+

#get\_order
~~~~~~~~~~~

/v2/order
~~~~~~~~~

***GET***
'''''''''

**Summary:** Get information of specified order. **Description:** Get
information of specified order.

**Parameters**

+--------+--------------+--------------------+------------+-----------+
| Name   | Located in   | Description        | Required   | Schema    |
+========+==============+====================+============+===========+
| id     | query        | Unique order id.   | Yes        | integer   |
+--------+--------------+--------------------+------------+-----------+

#get\_account\_info
~~~~~~~~~~~~~~~~~~~

/v2/members/me
~~~~~~~~~~~~~~

***GET***
'''''''''

**Summary:** Get your profile and accounts info. **Description:** Get
your profile and accounts info.

**Responses**

+--------+---------------------------------------+
| Code   | Description                           |
+========+=======================================+
| 200    | Get your profile and accounts info.   |
+--------+---------------------------------------+

#get\_available\_markets
~~~~~~~~~~~~~~~~~~~~~~~~

/v2/markets
~~~~~~~~~~~

***GET***
'''''''''

**Summary:** Get all available markets.

**Description:** Get all available markets.

**Responses**

+--------+------------------------------+
| Code   | Description                  |
+========+==============================+
| 200    | Get all available markets.   |
+--------+------------------------------+

#tickers
~~~~~~~~

/v2/tickers
~~~~~~~~~~~

***GET***
'''''''''

**Summary:** Get ticker of all markets. **Description:** Get ticker of
all markets.

**Responses**

+--------+------------------------------+
| Code   | Description                  |
+========+==============================+
| 200    | Get ticker of all markets.   |
+--------+------------------------------+

#trades
~~~~~~~

/v2/trades
~~~~~~~~~~

***GET***
'''''''''

**Summary:** Get recent trades on market, each trade is included only
once. Trades are sorted in reverse creation order. **Description:** Get
recent trades on market, each trade is included only once. Trades are
sorted in reverse creation order.

**Parameters**

+-------+-------------+--------------+-----------+-------+
| Name  | Located in  | Description  | Required  | Schem |
|       |             |              |           | a     |
+=======+=============+==============+===========+=======+
| marke | query       | Unique       | Yes       | strin |
| t     |             | market id.   |           | g     |
|       |             | It's always  |           |       |
|       |             | in the form  |           |       |
|       |             | of xxxyyy,   |           |       |
|       |             | where xxx is |           |       |
|       |             | the base     |           |       |
|       |             | currency     |           |       |
|       |             | code, yyy is |           |       |
|       |             | the quote    |           |       |
|       |             | currency     |           |       |
|       |             | code, e.g.   |           |       |
|       |             | 'btcusd'.    |           |       |
|       |             | All          |           |       |
|       |             | available    |           |       |
|       |             | markets can  |           |       |
|       |             | be found at  |           |       |
|       |             | /api/v2/mark |           |       |
|       |             | ets.         |           |       |
+-------+-------------+--------------+-----------+-------+
| limit | query       | Limit the    | No        | integ |
|       |             | number of    |           | er    |
|       |             | returned     |           |       |
|       |             | trades.      |           |       |
|       |             | Default to   |           |       |
|       |             | 50.          |           |       |
+-------+-------------+--------------+-----------+-------+
| times | query       | An integer   | No        | integ |
| tamp  |             | represents   |           | er    |
|       |             | the seconds  |           |       |
|       |             | elapsed      |           |       |
|       |             | since Unix   |           |       |
|       |             | epoch. If    |           |       |
|       |             | set, only    |           |       |
|       |             | trades       |           |       |
|       |             | executed     |           |       |
|       |             | before the   |           |       |
|       |             | time will be |           |       |
|       |             | returned.    |           |       |
+-------+-------------+--------------+-----------+-------+
| from  | query       | Trade id. If | No        | integ |
|       |             | set, only    |           | er    |
|       |             | trades       |           |       |
|       |             | created      |           |       |
|       |             | after the    |           |       |
|       |             | trade will   |           |       |
|       |             | be returned. |           |       |
+-------+-------------+--------------+-----------+-------+
| to    | query       | Trade id. If | No        | integ |
|       |             | set, only    |           | er    |
|       |             | trades       |           |       |
|       |             | created      |           |       |
|       |             | before the   |           |       |
|       |             | trade will   |           |       |
|       |             | be returned. |           |       |
+-------+-------------+--------------+-----------+-------+
| order | query       | If set,      | No        | strin |
| \_by  |             | returned     |           | g     |
|       |             | trades will  |           |       |
|       |             | be sorted in |           |       |
|       |             | specific     |           |       |
|       |             | order,       |           |       |
|       |             | default to   |           |       |
|       |             | 'desc'.      |           |       |
+-------+-------------+--------------+-----------+-------+

**Responses**

+-------+--------------+
| Code  | Description  |
+=======+==============+
| 200   | Get recent   |
|       | trades on    |
|       | market, each |
|       | trade is     |
|       | included     |
|       | only once.   |
|       | Trades are   |
|       | sorted in    |
|       | reverse      |
|       | creation     |
|       | order.       |
+-------+--------------+

#my\_trades
~~~~~~~~~~~

/v2/trades/my
~~~~~~~~~~~~~

***GET***
'''''''''

**Summary:** Get your executed trades. Trades are sorted in reverse
creation order. **Description:** Get your executed trades. Trades are
sorted in reverse creation order.

**Parameters**

+-------+-------------+--------------+-----------+-------+
| Name  | Located in  | Description  | Required  | Schem |
|       |             |              |           | a     |
+=======+=============+==============+===========+=======+
| marke | query       | Unique       | Yes       | strin |
| t     |             | market id.   |           | g     |
|       |             | It's always  |           |       |
|       |             | in the form  |           |       |
|       |             | of xxxyyy,   |           |       |
|       |             | where xxx is |           |       |
|       |             | the base     |           |       |
|       |             | currency     |           |       |
|       |             | code, yyy is |           |       |
|       |             | the quote    |           |       |
|       |             | currency     |           |       |
|       |             | code, e.g.   |           |       |
|       |             | 'btcusd'.    |           |       |
|       |             | All          |           |       |
|       |             | available    |           |       |
|       |             | markets can  |           |       |
|       |             | be found at  |           |       |
|       |             | /api/v2/mark |           |       |
|       |             | ets.         |           |       |
+-------+-------------+--------------+-----------+-------+
| limit | query       | Limit the    | No        | integ |
|       |             | number of    |           | er    |
|       |             | returned     |           |       |
|       |             | trades.      |           |       |
|       |             | Default to   |           |       |
|       |             | 50.          |           |       |
+-------+-------------+--------------+-----------+-------+
| times | query       | An integer   | No        | integ |
| tamp  |             | represents   |           | er    |
|       |             | the seconds  |           |       |
|       |             | elapsed      |           |       |
|       |             | since Unix   |           |       |
|       |             | epoch. If    |           |       |
|       |             | set, only    |           |       |
|       |             | trades       |           |       |
|       |             | executed     |           |       |
|       |             | before the   |           |       |
|       |             | time will be |           |       |
|       |             | returned.    |           |       |
+-------+-------------+--------------+-----------+-------+
| from  | query       | Trade id. If | No        | integ |
|       |             | set, only    |           | er    |
|       |             | trades       |           |       |
|       |             | created      |           |       |
|       |             | after the    |           |       |
|       |             | trade will   |           |       |
|       |             | be returned. |           |       |
+-------+-------------+--------------+-----------+-------+
| to    | query       | Trade id. If | No        | integ |
|       |             | set, only    |           | er    |
|       |             | trades       |           |       |
|       |             | created      |           |       |
|       |             | before the   |           |       |
|       |             | trade will   |           |       |
|       |             | be returned. |           |       |
+-------+-------------+--------------+-----------+-------+
| order | query       | If set,      | No        | strin |
| \_by  |             | returned     |           | g     |
|       |             | trades will  |           |       |
|       |             | be sorted in |           |       |
|       |             | specific     |           |       |
|       |             | order,       |           |       |
|       |             | default to   |           |       |
|       |             | 'desc'.      |           |       |
+-------+-------------+--------------+-----------+-------+

**Responses**

+-------+--------------+
| Code  | Description  |
+=======+==============+
| 200   | Get your     |
|       | executed     |
|       | trades.      |
|       | Trades are   |
|       | sorted in    |
|       | reverse      |
|       | creation     |
|       | order.       |
+-------+--------------+

Test
----

Just clone the repo, install dependencies as you would in development
and run ``nose2`` or ``python setup.py test``

Contributing
------------

1. Fork it ( https://github.com/vexbiexchange/python-api-client/fork )
2. Create your feature branch (``git checkout -b my-new-feature``)
3. Commit your changes (``git commit -am 'Add some feature'``)
4. Push to the branch (``git push origin my-new-feature``)
5. Create a new Pull Request

.. |Coverage Status| image:: https://coveralls.io/repos/github/vexbiexchange/python-api-client/badge.svg?branch=master
   :target: https://coveralls.io/github/vexbiexchange/python-api-client?branch=master
.. |Build Status| image:: https://travis-ci.org/vexbiexchange/python-api-client.svg?branch=master
   :target: https://travis-ci.org/vexbiexchange/python-api-client
.. |PyPI version| image:: https://badge.fury.io/py/vexbi.svg
   :target: https://badge.fury.io/py/vexbi
