Skip to content

Commit

Permalink
Merge branch 'feature/public_endpoints' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sammchardy committed Nov 15, 2017
2 parents cab8668 + 9e61a47 commit 070c84c
Show file tree
Hide file tree
Showing 19 changed files with 1,699 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/_build
95 changes: 95 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
=============================
Welcome to python-idex v0.1.0
=============================

.. image:: https://img.shields.io/pypi/v/python-idex.svg
:target: https://pypi.python.org/pypi/python-idex

.. image:: https://img.shields.io/pypi/l/python-idex.svg
:target: https://pypi.python.org/pypi/python-idex

.. image:: https://img.shields.io/travis/sammchardy/python-idex.svg
:target: https://travis-ci.org/sammchardy/python-idex

.. image:: https://img.shields.io/coveralls/sammchardy/python-idex.svg
:target: https://coveralls.io/github/sammchardy/python-idex

.. image:: https://img.shields.io/pypi/wheel/python-idex.svg
:target: https://pypi.python.org/pypi/python-idex

.. image:: https://img.shields.io/pypi/pyversions/python-idex.svg
:target: https://pypi.python.org/pypi/python-idex

This is an unofficial Python wrapper for the `IDEX exchanges REST API v1 <https://github.com/AuroraDAO/idex-api-docs>`_. I am in no way affiliated with IDEX, use at your own risk.

PyPi
https://pypi.python.org/pypi/python-idex

Source code
https://github.com/sammchardy/python-idex

Documentation
https://python-idex.readthedocs.io/en/latest/


Features
--------

- Implementation of all non trading REST endpoints.
- Helper functions for your wallet address
- Response exception handling

Quick Start
-----------

Register an account with `Idex <https://idex.market/>`_.

.. code:: bash
pip install python-idex
.. code:: python
from kucoin.idex import Client
client = Client(address, private_key)
# get currencies
currencies = client.get_currencies()
# get market depth
depth = client.get_order_book('ETH_SAN')
# get your balances
balances = client.get_my_balances()
# get your open orders
orders = client.get_my_open_orders('ETH_SAN')
For more `check out the documentation <https://python-kucoin.readthedocs.io/en/latest/>`_.

TODO
----

- Trading endpoints
- Websocket endpoints

Donate
------

If this library helped you out feel free to donate.

- ETH: 0xD7a7fDdCfA687073d7cC93E9E51829a727f9fE70
- NEO: AVJB4ZgN7VgSUtArCt94y7ZYT6d5NDfpBo
- BTC: 1Dknp6L6oRZrHDECRedihPzx2sSfmvEBys

Other Exchanges
---------------

If you use `Binance <https://www.binance.com/register.html?ref=10099792>`_ check out my `python-binance <https://github.com/sammchardy/python-binance>`_ library.

If you use `Quoinex <https://accounts.quoinex.com/sign-up?affiliate=PAxghztC67615>`_
or `Qryptos <https://accounts.qryptos.com/sign-up?affiliate=PAxghztC67615>`_ check out my `python-quoine <https://github.com/sammchardy/python-quoine>`_ library.

If you use `Kucoin <https://www.kucoin.com/#/?r=E42cWB>`_ check out my `python-kucoin <https://github.com/sammchardy/python-kucoin>`_ library.
23 changes: 23 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = python-idex
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

rst:
sphinx-apidoc -f -o ./ ../
7 changes: 7 additions & 0 deletions docs/account.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Account Endpoints
=================

.. autoclass:: idex.client.Client
:members: get_balances, get_my_balances, get_transfers, get_my_transfers, get_next_nonce, get_my_next_nonce
:noindex:
:member-order: bysource
184 changes: 184 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# python-idex documentation build configuration file
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.imgmath',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'python-idex'
copyright = '2017, Sam McHardy'
author = 'Sam McHardy'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.2.0'
# The full version, including alpha/beta/rc tags.
release = '0.2.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'python-idexndoc'


# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'python-idex.tex', 'python-idex Documentation',
'Sam McHardy', 'manual'),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'python-idex', 'python-idex Documentation',
[author], 1)
]


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'python-idex', 'python-idex Documentation',
author, 'python-idex', 'One line description of project.',
'Miscellaneous'),
]


def skip(app, what, name, obj, skip, options):
# Ensure that the __init__ method gets documented.
if name == "__init__":
return False
return skip


def setup(app):
app.connect("autodoc-skip-member", skip)

7 changes: 7 additions & 0 deletions docs/currencies.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Currency Endpoints
==================

.. autoclass:: idex.client.Client
:members: get_currencies, get_currency
:noindex:
:member-order: bysource
42 changes: 42 additions & 0 deletions docs/exceptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Exceptions
==========

IdexWalletAddressNotFoundException
----------------------------------

Raised if a wallet address has not been set.

IdexPrivateKeyNotFoundException
-------------------------------

Raised if the private key has not been set.

IdexCurrencyNotFoundException
-----------------------------

Raised if a requested currency is not found.

IdexResponseException
-----------------------

Raised if a non JSON response is returned.

IdexAPIException
------------------

On an API call error a idex.exceptions.IdexAPIException will be raised.

The exception provides access to the

- `status_code` - response status code
- `response` - response object
- `message` - IDEX error message
- `request` - request object if available

.. code:: python
try:
client.get_currencies()
except IdexAPIException as e:
print(e.status_code)
print(e.message)
7 changes: 7 additions & 0 deletions docs/exchange.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Exchange Endpoints
==================

.. autoclass:: idex.client.Client
:members: get_contract_address
:noindex:
:member-order: bysource
20 changes: 20 additions & 0 deletions docs/idex.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Idex API
========

client module
----------------------

.. automodule:: idex.client
:members:
:undoc-members:
:show-inheritance:
:member-order: bysource

exceptions module
--------------------------

.. automodule:: idex.exceptions
:members:
:undoc-members:
:show-inheritance:
:member-order: bysource
Loading

0 comments on commit 070c84c

Please sign in to comment.