{ "info": { "author": "Gimo", "author_email": "self@gimo.me", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "# otcbtc-client\n\nA client for OTCBTC, which supports the OTCBTC public API and Auth API based on the [official API documentation](https://github.com/otcbtc/otcbtc-exchange-api-doc), for more information, please read the documentation.\n\n[![PyPI](https://img.shields.io/pypi/v/otcbtc-client.svg)](https://pypi.org/project/otcbtc-client/)\n[![PyPI - License](https://img.shields.io/pypi/l/otcbtc-client.svg)](https://pypi.org/project/otcbtc-client/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/otcbtc-client.svg)](https://pypi.org/project/otcbtc-client/)\n[![Build Status](https://travis-ci.org/masakichi/otcbtc-client.svg?branch=master)](https://travis-ci.org/masakichi/otcbtc-client)\n[![codecov](https://codecov.io/gh/masakichi/otcbtc-client/branch/master/graph/badge.svg)](https://codecov.io/gh/masakichi/otcbtc-client)\n\n## Overview\n\nWhether you're building a custom app or integrating other service into OTCBTC, OTCBTC SDK for Python allows you to leverage the flexibility of Python to get your project up and running as quickly as possible.\n\n## Installation\n\nPyPI are recommended to install OTCBTC SDK for Python, use pip or pipenv.\n\n```python\npip install otcbtc-client\n```\n\n## Usage\n\nYou need to instantiate an client from OTCBTCClient class first, with your own API_KEY and API_SECRET. \n\n```python\nfrom otcbtc_client.client import OTCBTCClient\n\nauth_client = OTCBTCClient(API_KEY, API_SECRET) # Need to access auth APIs\n```\n\n*For public APIs, API_KEY and API_SECRET are not necessary.*\n\n```python\nclient = OTCBTCClient() # Use public APIs only.\n```\n\n### Market\n\n#### Get all available markets(Public API)\n\n```python\nIn [1]: client.market.all()\nOut[1]:\n[{'id': 'btceth', 'name': 'BTC/ETH', 'ticker_id': 'btc_eth'},\n {'id': 'eoseth', 'name': 'EOS/ETH', 'ticker_id': 'eos_eth'},\n {'id': 'bcheth', 'name': 'BCH/ETH', 'ticker_id': 'bch_eth'},\n {'id': 'gxseth', 'name': 'GXS/ETH', 'ticker_id': 'gxs_eth'},\n {'id': 'zeceth', 'name': 'ZEC/ETH', 'ticker_id': 'zec_eth'},...]\n```\n\n### Ticker\n\n#### Get ticker of all markets(Public API)\n\n```python\nIn [1]: client.ticker.all()\nOut[1]:\n{'ada_btc': {'at': 1526921081,\n 'ticker': {'buy': '0.0000301',\n 'high': '0.0000309',\n 'last': '0.00003027',\n 'low': '0.0000293',\n 'open': 2.943e-05,\n 'sell': '0.0000306',\n 'vol': '60930.97947734'}},\n 'ada_eth': {'at': 1526921081,\n 'ticker': {'buy': '0.00034758',\n 'high': '0.000372',\n 'last': '0.00035391',\n 'low': '0.00034335',\n 'open': 0.0003498,\n 'sell': '0.00036176',\n 'vol': '70583.0778626'}},...}\n```\n\n#### Get ticker of specific market(Public API)\n\n```python\nIn [1]: client.ticker.fetch('otbeth')\nOut[1]:\n{'at': 1526921191,\n 'ticker': {'buy': '0.00062634',\n 'high': '0.000655',\n 'last': '0.00063229',\n 'low': '0.00061501',\n 'open': 0.0006402,\n 'sell': '0.00064',\n 'vol': '900260.78491758'}}\n```\n\n### Order Book\n\n#### Get the order book of specified market(Public API)\n\n```python\nIn [1]: client.order_book.fetch(market='otbeth', asks_limit=1, bids_limit=1)\nOut[1]:\n{'asks': [{'avg_price': '0.0',\n 'created_at': '2018-05-22T00:43:18+08:00',\n 'executed_volume': '0.0',\n 'id': 37519992,\n 'market': 'otbeth',\n 'ord_type': 'limit',\n 'price': '0.00064',\n 'remaining_volume': '1107.93650478',\n 'side': 'sell',\n 'state': 'wait',\n 'trades_count': 0,\n 'volume': '1107.93650478'}],\n 'bids': [{'avg_price': '0.0',\n 'created_at': '2018-05-22T00:48:31+08:00',\n 'executed_volume': '0.0',\n 'id': 37521683,\n 'market': 'otbeth',\n 'ord_type': 'limit',\n 'price': '0.00062636',\n 'remaining_volume': '159.65259595',\n 'side': 'buy',\n 'state': 'wait',\n 'trades_count': 0,\n 'volume': '159.65259595'}]}\n```\n\n### Trade\n\n#### Get recent trades on market(Public Api)\n\n*Each trade is included only once. Trades are sorted in reverse creation order*\n\n```python\nIn [1]: client.trade.fetch(market='otbeth', limit=1)\nOut[1]:\n[{'at': 1526921408,\n 'created_at': '2018-05-22T00:50:08+08:00',\n 'funds': '0.5631751916118198',\n 'id': 1813244,\n 'market': 'otbeth',\n 'price': '0.00063297',\n 'side': 'up',\n 'volume': '889.73441334'}]\n```\n\nOther parameters:\n\n- timestamp: An integer represents the seconds elapsed since Unix epoch. If set, only trades executed before the time will be returned.\n- **from_**: Trade id. If set, only trades created after the trade will be returned.\n- to: Trade id. If set, only trades created before the trade will be returned.\n- order_by: If set, returned trades will be sorted in specific order, default to 'desc\u2019.\n\n### Timestammp\n\n#### Get server current time, in seconds since Unix epoch(Public API)\n\n```python\nIn [1]: client.timestamp.fetch() # or just call client.timestamp()\nOut[1]: 1526921749\n```\n\n### Kline\n\n#### Get OHLC(k line) of specific market(Public API)\n\n```python\nIn [1]: client.kline.fetch(market='otbeth', limit=1)\nOut[1]: [[1526921880, 0.00063846, 0.00063846, 0.00063846, 0.00063846, 823.5836]]\n```\n\nOther parameters:\n\n- period: Time period of K line, default to 1. You can choose between 1, 5, 15, 30, 60, 120, 240, 360, 720, 1440, 4320, 10080. Default value : 1\n- timestamp: An integer represents the seconds elapsed since Unix epoch. If set, only k-line data after that time will be returned.\n\n### Klines with pending trades\n\n#### Get K data with pending trades(Public API)\n\nWhich are the trades not included in K data yet, because there\u2019s delay between trade generated and processed by K data generator.\n\n```python\nIn [1]: client.kline.with_pending_trades(market='otbeth', trade_id=1, limit=1)\nOut[1]:\n{'k': [[1526922180, 0.00063787, 0.00063787, 0.00063787, 0.00063787, 998.8065]],\n 'trades': []}\n```\n\n### User\n\n#### Get your profile and accounts info(Auth API)\n\n```python\nIn [1]: auth_client.user.fetch()\nOut[1]:\n{'accounts': [{'balance': '0.0',\n 'currency': 'eos',\n 'locked': '0.0',\n 'saving': '0.0'},\n {'balance': '0.0',\n 'currency': 'btc',\n 'locked': '0.0',\n 'saving': '0.0'},...],\n 'email': '***',\n 'user_name': '***'}\n```\n\n### List Orders\n\n#### Get your orders, results is paginated(Auth API)\n\n```python\nauth_client.order.list_orders(market=None, state=None, limit=None, page=None, order_by=None)\n```\n\nParamters:\n\n- market: Unique market id. It\u2019s always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'otbeth'. All available markets can be found at /api/v2/markets. If left blank, the api will return your orders of all markets.\n- state: Filter order by state, default to 'wait' (active orders). Other options:'cancel', 'done'\n- limit: Limit the number of returned price levels. Default to 100.\n- page: Specify the page of paginated results. Default value: 1\n- order_by: If set, returned trades will be sorted in specific order, default to 'asc'.\n\n### List Order\n\n#### Get information of specified order(Auth API)\n\n```python\nauth_client.order.list_order(id) # Unique order id\n```\n\n### Create Order\n\n#### Create a Sell/Buy order(Auth API)\n\n```python\nauth_client.order.create_order(market, side, volume, price, ord_type=None)\n```\n\nParameters:\n\n- market(required): Unique market id. It\u2019s always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'otbeth'. All available markets can be found at /api/v2/markets.\n- side(required): Either 'sell' or 'buy'.\n- volume(required): The amount user want to sell/buy. An order could be partially executed, e.g. an order sell 100 otb can be matched with a buy 60 otb order, left 40 otb to be sold; in this case the order\u2019s volume would be '100.0', its remaining_volume would be '40.0', its executed volume is '60.0'.\n- price: Price for each unit. e.g. If you want to sell/buy 1 otb at 0.002 ETH, the price is \u20180.002\u2019.\n- ord_type: Type of order, now only 'limit'.\n\n### Cancel Order\n\n#### Cancel an order(Auth API)\n\n```python\nauth_client.order.cancel_order(id)\n```\n\n### Cancel Orders\n\n#### Cancel all your orders(Auth API)\n\n```python\nauth_client.order.cancel_orders(side=None) # If present, only sell orders (asks) or buy orders (bids) will be canncelled. Vaules: 'sell', 'buy'\n```\n\n### My Trades\n\n#### Get your executed trades(Auth API) \n\nTrades are sorted in reverse creation order.\n\n```python\nauth_client.trade.my_trades(market, limit=None, timestamp=None, from_=None, to=None, order_by=None)\n```\n\nParameters:\n\n- market(required): Unique market id. It\u2019s always in the form of xxxyyy, where xxx is the base currency code, yyy is the quote currency code, e.g. 'otbeth'. All available markets can be found at /api/v2/markets.\n- limit: Limit the number of returned trades. Default to 50. Range 1..1000\n- timestamp: An integer represents the seconds elapsed since Unix epoch. If set, only trades executed before the time will be returned.\n- from: Trade id. If set, only trades created after the trade will be returned.\n- to: Trade id. If set, only trades created before the trade will be returned.\n- order_by:If set, returned trades will be sorted in specific order, default to 'desc'. Values: 'asc', 'desc'\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/masakichi/otcbtc-client", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "otcbtc-client", "package_url": "https://pypi.org/project/otcbtc-client/", "platform": "", "project_url": "https://pypi.org/project/otcbtc-client/", "project_urls": { "Homepage": "https://github.com/masakichi/otcbtc-client" }, "release_url": "https://pypi.org/project/otcbtc-client/0.2.1/", "requires_dist": [ "requests (<3.0a0,>=2.11)", "future" ], "requires_python": "", "summary": "OTCBTC SDK for Python", "version": "0.2.1" }, "last_serial": 5612189, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "6ab2523222f900b87f329abd37fe8a17", "sha256": "0ba6384d6387f5899a833bd07d6217a106871508d3cd8a6ccaa902ac1903eca0" }, "downloads": -1, "filename": "otcbtc_client-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6ab2523222f900b87f329abd37fe8a17", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6979, "upload_time": "2018-05-21T03:26:54", "url": "https://files.pythonhosted.org/packages/8e/a8/e13c6fc1ee9b49032ec1f59e71c6e1d4c3cb315a840ae86443dae260f869/otcbtc_client-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8fba852681d71b43d03c02bf03743013", "sha256": "e346a1dd04a56675c9b5a18cc14a1e138281560485599d671023e0316d420214" }, "downloads": -1, "filename": "otcbtc_client-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8fba852681d71b43d03c02bf03743013", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3028, "upload_time": "2018-05-21T03:26:55", "url": "https://files.pythonhosted.org/packages/60/12/1e2215d4493ac0d6a96ad72d9e916a9700754b40daac1697c459bcce8b66/otcbtc_client-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "e0ee9acc06fa583d1e173e1516aa76b6", "sha256": "1456d6d9b70e2bf558a02ef9ba459de6d5aed117e310437ef81abcdecddb84fd" }, "downloads": -1, "filename": "otcbtc_client-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e0ee9acc06fa583d1e173e1516aa76b6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10051, "upload_time": "2018-05-21T18:18:26", "url": "https://files.pythonhosted.org/packages/3d/8b/2b6e4f968ba2aa625f2a32aeddd2aed0cb64b6764fb8f9aece15936e8153/otcbtc_client-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f51dd6210751eca6163bf1b7cd5620eb", "sha256": "d510d78bfdb926a793ac6c484a24b41350ab88bfc6e78261b0bf67fd90946be2" }, "downloads": -1, "filename": "otcbtc_client-0.2.0.tar.gz", "has_sig": false, "md5_digest": "f51dd6210751eca6163bf1b7cd5620eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9645, "upload_time": "2018-05-21T18:18:27", "url": "https://files.pythonhosted.org/packages/60/9e/64e9322f6a3bb2a557bc34974c6047bf8fb5b507acb1a9512a6fc1c26099/otcbtc_client-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "e1aa0776342dcc184370b9009c16c2ee", "sha256": "8332816dfd9d4ed2807e1256b64372daa12c86275c232af86e225e968e8e5b25" }, "downloads": -1, "filename": "otcbtc_client-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e1aa0776342dcc184370b9009c16c2ee", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10034, "upload_time": "2019-07-31T08:15:42", "url": "https://files.pythonhosted.org/packages/94/8d/126500d4039c4069475f33b7c2d934a76846ea60a4565877745f9a8e439f/otcbtc_client-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "04265e194541ca2ccec9babb8153d3f5", "sha256": "0baadb6ce018e39ec7426b72a5d91fd4bd274b349b8d3149fb126b6e99f3171e" }, "downloads": -1, "filename": "otcbtc_client-0.2.1.tar.gz", "has_sig": false, "md5_digest": "04265e194541ca2ccec9babb8153d3f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8601, "upload_time": "2019-07-31T08:15:43", "url": "https://files.pythonhosted.org/packages/be/8c/3ddc090f542b02c835c2439f6f190287f6e741034004a778437a0a839d71/otcbtc_client-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e1aa0776342dcc184370b9009c16c2ee", "sha256": "8332816dfd9d4ed2807e1256b64372daa12c86275c232af86e225e968e8e5b25" }, "downloads": -1, "filename": "otcbtc_client-0.2.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e1aa0776342dcc184370b9009c16c2ee", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10034, "upload_time": "2019-07-31T08:15:42", "url": "https://files.pythonhosted.org/packages/94/8d/126500d4039c4069475f33b7c2d934a76846ea60a4565877745f9a8e439f/otcbtc_client-0.2.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "04265e194541ca2ccec9babb8153d3f5", "sha256": "0baadb6ce018e39ec7426b72a5d91fd4bd274b349b8d3149fb126b6e99f3171e" }, "downloads": -1, "filename": "otcbtc_client-0.2.1.tar.gz", "has_sig": false, "md5_digest": "04265e194541ca2ccec9babb8153d3f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8601, "upload_time": "2019-07-31T08:15:43", "url": "https://files.pythonhosted.org/packages/be/8c/3ddc090f542b02c835c2439f6f190287f6e741034004a778437a0a839d71/otcbtc_client-0.2.1.tar.gz" } ] }