{ "info": { "author": "s4w3d0ff", "author_email": "info@s4w3d0ff.host", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "[![python](https://img.shields.io/badge/python-2.7%20%26%203-blue.svg)![licence](https://img.shields.io/badge/licence-GPL%20v2-blue.svg)](https://github.com/s4w3d0ff/python-poloniex/blob/master/LICENSE) [![release](https://img.shields.io/github/release/s4w3d0ff/python-poloniex.svg)![release build](https://travis-ci.org/s4w3d0ff/python-poloniex.svg?branch=v0.5.7)](https://github.com/s4w3d0ff/python-poloniex/releases) \n[![master](https://img.shields.io/badge/branch-master-blue.svg)![master build](https://api.travis-ci.org/s4w3d0ff/python-poloniex.svg?branch=master)](https://github.com/s4w3d0ff/python-poloniex/tree/master) [![dev](https://img.shields.io/badge/branch-dev-blue.svg)![dev build](https://api.travis-ci.org/s4w3d0ff/python-poloniex.svg?branch=dev)](https://github.com/s4w3d0ff/python-poloniex/tree/dev) \n\nInspired by [this](http://pastebin.com/8fBVpjaj) wrapper written by 'oipminer' \n> I (s4w3d0ff) am not affiliated with, nor paid by [Poloniex](https://poloniex.com). If you wish to contribute to the repository please read [CONTRIBUTING.md](https://github.com/s4w3d0ff/python-poloniex/blob/master/CONTRIBUTING.md). All and any help is appreciated.\n#### Features:\n- [x] Python 2.7 and 3.5+\n- [x] Pypi\n- [x] Travis\n- [x] Websocket api support\n- [x] Minimal amount of dependencies\n- [x] Internal checks to reduce external api errors\n- [x] Rate limiter to keep from going over call limits\n- [x] Retries failed api calls during connection issues\n\n### Install:\n```\npip install --upgrade poloniexapi\n```\n\n### Usage:\nSee the [wiki](https://github.com/s4w3d0ff/python-poloniex/wiki) or `help(poloniex)` for more.\n\nAll api calls are done through an instance of `poloniex.Poloniex`. You can use the instance as follows:\n```python\n# import this package\nfrom poloniex import Poloniex\n\n# make an instance of poloniex.Poloniex\npolo = Poloniex()\n\n# show the ticker\nprint(polo('returnTicker'))\n```\nUsing the instances `__call__` method (shown above) you can pass the command string as the first argument to make an api call. The `poloniex.Poloniex` class also has 'helper' methods for each command that will help 'sanitize' the commands arguments. For example, `Poloniex.returnChartData('USDT_BTC', period=777)` will raise `PoloniexError(\"777 invalid candle period\")`.\n\n```python\n# using a 'helper' method\nprint(polo.returnChartData(currencyPair='BTC_LTC', period=900))\n# bypassing 'helper'\nprint(polo(command='returnChartData', args={'currencyPair': 'BTC_LTC',\n 'period': 900}))\n```\nAlmost every api command can be called this way. This wrapper also checks that the command you pass to the `command` arg is a valid command to send to poloniex, this helps reduce api errors due to typos.\n\n#### Private Commands:\nTo use the private api commands you first need an api key and secret (supplied by poloniex). When creating the instance of `poloniex.Poloniex` you can pass your api key and secret to the object like so:\n\n```python\nimport poloniex\npolo = poloniex.Poloniex(key='your-Api-Key-Here-xxxx', secret='yourSecretKeyHere123456789')\n\n# or this works\npolo.key = 'your-Api-Key-Here-xxxx'\npolo.secret = 'yourSecretKeyHere123456789'\n\n# get your balances\nbalance = polo.returnBalances()\nprint(\"I have %s ETH!\" % balance['ETH'])\n\n# or use '__call__'\nbalance = polo('returnBalances')\nprint(\"I have %s BTC!\" % balance['BTC'])\n```\n#### Trade History:\nPoloniex has two api commands with the same name `returnTradeHistory`. To work around this without splitting up the commands or having to specify 'public' or 'private' we use the helper method `Poloniex.marketTradeHist` for public trade history and `Poloniex.returnTradeHistory` for private trades. If you try to bypass the helper method using `Poloniex.__call__`, it will call the private command.\n\n**Public** trade history:\n```python\nprint(polo.marketTradeHist('BTC_ETH'))\n```\n**Private** trade history:\n```python\nprint(polo.returnTradeHistory('BTC_ETH'))\n```\n\nYou can also not use the 'helper' methods at all and use `poloniex.PoloniexBase` which only has `returnMarketHist` and `__call__` to make rest api calls.\n\n#### Websocket Usage:\nTo connect to the websocket api use the `PoloniexSocketed` class like so:\n```python\nimport poloniex\nimport logging\nfrom time import sleep\n\n# helps show what is going on\nlogging.basicConfig()\npoloniex.logger.setLevel(logging.DEBUG)\n\ndef on_volume(data):\n print(data)\n# make instance\nsock = poloniex.PoloniexSocketed()\n# start the websocket thread and subscribe to '24hvolume' setting the callback to 'on_volume'\nsock.startws(subscribe={'24hvolume': on_volume})\n# give the socket some time to init\nsleep(5)\n# use the channel name str or id int to subscribe/unsubscribe\nsock.subscribe(chan='ticker', callback=print)\nsleep(1)\n# unsub from ticker using id (str name can be use as well)\nsock.unsubscribe(1002)\nsleep(4)\n# stop websocket\nsock.stopws()\n\n```\n\n```\nINFO:poloniex:Websocket thread started\nDEBUG:poloniex:Subscribed to 24hvolume\n[1010]\nDEBUG:poloniex:Subscribed to ticker\n[241, '86.59997298', '86.68262835', '85.69590501', '0.01882321', '22205.56419338', '258.30264061', 0, '87.31843098', '82.81638725']\n...\n...\n[254, '5.89427014', '6.14542299', '5.92000026', '-0.03420118', '9978.11197201', '1649.83975863', 0, '6.19642428', '5.74631502']\nDEBUG:poloniex:Unsubscribed to ticker\n[1010]\n[1010]\n[1010]\n['2019-06-07 04:16', 2331, {'BTC': '2182.115', 'ETH': '490.635', 'XMR': '368.983', 'USDT': '7751402.061', 'USDC': '5273463.730'}]\nDEBUG:poloniex:Websocket Closed\nINFO:poloniex:Websocket thread stopped/joined\n```\nYou can also subscribe and start the websocket thread when creating an instance of `PoloniexSocketed` by using the `subscribe` and `start` args:\n```python\n\nsock = poloniex.PoloniexSocketed(subscribe={'24hvolume': print}, start=True)\n\n```\n\n\n**More examples of how to use websocket push API can be found [here](https://github.com/s4w3d0ff/python-poloniex/tree/master/examples).**", "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/s4w3d0ff/python-poloniex", "keywords": "poloniex,poloniexapi,exchange,api,cryptocoin,tradebot,polo,websocket,rest,push", "license": "GPL v2", "maintainer": "", "maintainer_email": "", "name": "poloniexapi", "package_url": "https://pypi.org/project/poloniexapi/", "platform": "", "project_url": "https://pypi.org/project/poloniexapi/", "project_urls": { "Homepage": "https://github.com/s4w3d0ff/python-poloniex" }, "release_url": "https://pypi.org/project/poloniexapi/0.5.7/", "requires_dist": null, "requires_python": "", "summary": "Poloniex API wrapper for Python 2.7 and 3 with websocket support", "version": "0.5.7" }, "last_serial": 5531326, "releases": { "0.5.1": [ { "comment_text": "", "digests": { "md5": "8ff11e9367fae229c8c3950bf53b70e4", "sha256": "9fdcfdeb5d9d5b67b632279b246d894610bf10397a9ff89fc0072d8dfbd92984" }, "downloads": -1, "filename": "poloniexapi-0.5.1.tar.gz", "has_sig": false, "md5_digest": "8ff11e9367fae229c8c3950bf53b70e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12550, "upload_time": "2019-05-29T05:28:40", "url": "https://files.pythonhosted.org/packages/55/1b/408c4554e86a6ee9aab892df3dfb7e6ee074da374a30acb8f9773c460986/poloniexapi-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "1f619d2bf5b277d55132ef0a2f623a38", "sha256": "0ca4573c8f066c516b6b2420c722266a7fc4d3b86f10509862b7a188e40453e2" }, "downloads": -1, "filename": "poloniexapi-0.5.2.tar.gz", "has_sig": false, "md5_digest": "1f619d2bf5b277d55132ef0a2f623a38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12471, "upload_time": "2019-05-29T06:05:31", "url": "https://files.pythonhosted.org/packages/e9/c0/e9b51c566561f63892ef6663c6f5b67f906cbf0e654201e4b7f0f3a417fb/poloniexapi-0.5.2.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "efd8ea9af961d928438864c832606c11", "sha256": "aa43fd0932102f3d3607f5a0f223b50c9c76b86f0025cfbd11fb509e5068f22c" }, "downloads": -1, "filename": "poloniexapi-0.5.3.tar.gz", "has_sig": false, "md5_digest": "efd8ea9af961d928438864c832606c11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13992, "upload_time": "2019-05-30T05:01:10", "url": "https://files.pythonhosted.org/packages/90/b9/0a3c078ea0861b8be42293605ccf8a418d6fbbd60dce640230d92a2b21bf/poloniexapi-0.5.3.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "46345930df01948b3957eb4871b987a3", "sha256": "854e349e7664a659ff356dfbd386de6f26de5b32eafcb902e2af82c652629052" }, "downloads": -1, "filename": "poloniexapi-0.5.4.tar.gz", "has_sig": false, "md5_digest": "46345930df01948b3957eb4871b987a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14295, "upload_time": "2019-05-30T05:53:36", "url": "https://files.pythonhosted.org/packages/5c/65/607e116b01df0287b01c383da35466f9511cd209b5105413427af3010afb/poloniexapi-0.5.4.tar.gz" } ], "0.5.5": [ { "comment_text": "", "digests": { "md5": "46052f72adf43edf4ea3d753a0df6278", "sha256": "b51346e6386b7ce2cca579353afcb5c9b8449b3304ac82e66ff10d465df9a0f3" }, "downloads": -1, "filename": "poloniexapi-0.5.5.tar.gz", "has_sig": false, "md5_digest": "46052f72adf43edf4ea3d753a0df6278", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12575, "upload_time": "2019-06-07T05:03:32", "url": "https://files.pythonhosted.org/packages/aa/5f/6dabaac285a15986fa1e6354ff221a9564cde0cdf106f2ba4c08c0433be4/poloniexapi-0.5.5.tar.gz" } ], "0.5.6": [ { "comment_text": "", "digests": { "md5": "d867c698f40803372f6dc3315710b4eb", "sha256": "3837292d8a0f609392cf1868df8b59b9c0a8289a7f05db45f1497ecf4ef56bc3" }, "downloads": -1, "filename": "poloniexapi-0.5.6.tar.gz", "has_sig": false, "md5_digest": "d867c698f40803372f6dc3315710b4eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12671, "upload_time": "2019-06-16T15:16:54", "url": "https://files.pythonhosted.org/packages/82/5b/783f146a07024ea61d6a336ffd1c4c4a37f248cf9b0d5b401fac6034104b/poloniexapi-0.5.6.tar.gz" } ], "0.5.7": [ { "comment_text": "", "digests": { "md5": "85454fa2c50a7007c006048f7afe37c7", "sha256": "f26608e3abd2b53c7c314769d22699bcea76f19b7d3126744e083bffaa8c0442" }, "downloads": -1, "filename": "poloniexapi-0.5.7.tar.gz", "has_sig": false, "md5_digest": "85454fa2c50a7007c006048f7afe37c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12747, "upload_time": "2019-07-14T15:34:25", "url": "https://files.pythonhosted.org/packages/fb/ae/d9bd0d15e888fe3ec4af9d13ceb9cf149a00d02760be024fb2a7e05113b1/poloniexapi-0.5.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "85454fa2c50a7007c006048f7afe37c7", "sha256": "f26608e3abd2b53c7c314769d22699bcea76f19b7d3126744e083bffaa8c0442" }, "downloads": -1, "filename": "poloniexapi-0.5.7.tar.gz", "has_sig": false, "md5_digest": "85454fa2c50a7007c006048f7afe37c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12747, "upload_time": "2019-07-14T15:34:25", "url": "https://files.pythonhosted.org/packages/fb/ae/d9bd0d15e888fe3ec4af9d13ceb9cf149a00d02760be024fb2a7e05113b1/poloniexapi-0.5.7.tar.gz" } ] }