# pyindependentreserve
Python3 client for Interacting with Independent Reserve API - The Bitcoin and Digital Currency Market
# Install
```bash
$ pip install pyindependentreserve
```
# Usage REST API
```python
$ python
>>> import independentreserve as ir
>>> connection = ir.PublicMethods()
>>> connection.get_valid_limit_order_types()
[u'LimitBid', u'LimitOffer']
>>> api = PrivateMethods("your_api_key", "your_api_secret")
>>> api.get_open_orders()
{'TotalItems': ... etc
```
# Usage Websocket
pyindependentreserve uses python3 asyncio module to implement a producer consumer pattern to consume messages from the websocket.
Official websocket documentation can be found [here](https://github.com/independentreserve/websockets)
```python
from asyncio.queues import Queue
import websockets
import asyncio
import sys
from independentreserve import wss_subscribe
async def consumer(queue: asyncio.Queue):
while True:
item = await queue.get()
if item is None:
break
print("consuming item: {}".format(item))
if __name__ == "__main__":
try:
loop = asyncio.get_event_loop()
queue = asyncio.Queue(1000)
producer_coroutine = wss_subscribe(queue=queue, channel_name=["ticker-xbt-aud"])
consumer_coroutine = consumer(queue=queue)
loop.run_until_complete(asyncio.gather(producer_coroutine, consumer_coroutine))
loop.close()
except Exception as error:
print(error)
sys.exit(1)
```
# Support
If you like this project and would want to support it please consider taking a look
at the issues section at:
[Github Issues](https://github.com/MelchiSalins/pyindependentreserve/issues)
or consider donating to
Bitcoin: 1B2kZETHm9tjhPKtCCEo6eWhwT5TfXWE6u
Etherium: 0x00912fdef62ab7d9c1cbee712a58105eb1dbd42f
BitCash: 1B2kZETHm9tjhPKtCCEo6eWhwT5TfXWE6u
Raw data
{
"_id": null,
"home_page": "https://github.com/MelchiSalins/pyindependentreserve",
"name": "pyindependentreserve",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Bitcoin BlockChain Crypto-currency",
"author": "Melchi Salins",
"author_email": "melchisalins@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/47/4d/798d67d23d8ae2a58688d59af2e721f13fbabc221ddc994928448e70067d/pyindependentreserve-0.4.1.tar.gz",
"platform": null,
"description": "\n# pyindependentreserve\n\nPython3 client for Interacting with Independent Reserve API - The Bitcoin and Digital Currency Market\n\n# Install \n\n```bash\n$ pip install pyindependentreserve\n```\n\n# Usage REST API\n\n```python\n$ python\n>>> import independentreserve as ir\n>>> connection = ir.PublicMethods()\n>>> connection.get_valid_limit_order_types()\n[u'LimitBid', u'LimitOffer'] \n\n>>> api = PrivateMethods(\"your_api_key\", \"your_api_secret\")\n>>> api.get_open_orders()\n{'TotalItems': ... etc\n```\n\n# Usage Websocket\n\npyindependentreserve uses python3 asyncio module to implement a producer consumer pattern to consume messages from the websocket. \n\nOfficial websocket documentation can be found [here](https://github.com/independentreserve/websockets)\n\n```python\nfrom asyncio.queues import Queue\nimport websockets\nimport asyncio\nimport sys\n\nfrom independentreserve import wss_subscribe\n\n\nasync def consumer(queue: asyncio.Queue):\n while True:\n item = await queue.get()\n if item is None:\n break\n print(\"consuming item: {}\".format(item))\n\n\nif __name__ == \"__main__\":\n try:\n loop = asyncio.get_event_loop()\n queue = asyncio.Queue(1000)\n producer_coroutine = wss_subscribe(queue=queue, channel_name=[\"ticker-xbt-aud\"])\n consumer_coroutine = consumer(queue=queue)\n loop.run_until_complete(asyncio.gather(producer_coroutine, consumer_coroutine))\n loop.close()\n except Exception as error:\n print(error)\n sys.exit(1)\n```\n\n# Support\n\nIf you like this project and would want to support it please consider taking a look\nat the issues section at:\n\n[Github Issues](https://github.com/MelchiSalins/pyindependentreserve/issues)\n\nor consider donating to\n\nBitcoin: 1B2kZETHm9tjhPKtCCEo6eWhwT5TfXWE6u\nEtherium: 0x00912fdef62ab7d9c1cbee712a58105eb1dbd42f\nBitCash: 1B2kZETHm9tjhPKtCCEo6eWhwT5TfXWE6u\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python client for Interacting with Independent Reserve API - The Bitcoin and Digital Currency Market",
"version": "0.4.1",
"project_urls": {
"Homepage": "https://github.com/MelchiSalins/pyindependentreserve"
},
"split_keywords": [
"bitcoin",
"blockchain",
"crypto-currency"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fe9ca146ebe2084e07389bf9d6052656eb0459feea700ce8bb95624ec734f91c",
"md5": "732fa7d2fabad0fff76b07610a24f5e5",
"sha256": "3cfef1372d6fe7d738b61764a47c339a94600fcb47bb0d405a0ccafbd0a2764b"
},
"downloads": -1,
"filename": "pyindependentreserve-0.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "732fa7d2fabad0fff76b07610a24f5e5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12679,
"upload_time": "2023-10-20T15:30:50",
"upload_time_iso_8601": "2023-10-20T15:30:50.828624Z",
"url": "https://files.pythonhosted.org/packages/fe/9c/a146ebe2084e07389bf9d6052656eb0459feea700ce8bb95624ec734f91c/pyindependentreserve-0.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "474d798d67d23d8ae2a58688d59af2e721f13fbabc221ddc994928448e70067d",
"md5": "5bdfb9829708a4475bfda48ad0ce8a08",
"sha256": "5b3ee72a6a2da9e6d530d27ff36970bc1a432980bf979df30ad5750608ee20cc"
},
"downloads": -1,
"filename": "pyindependentreserve-0.4.1.tar.gz",
"has_sig": false,
"md5_digest": "5bdfb9829708a4475bfda48ad0ce8a08",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11629,
"upload_time": "2023-10-20T15:30:52",
"upload_time_iso_8601": "2023-10-20T15:30:52.287359Z",
"url": "https://files.pythonhosted.org/packages/47/4d/798d67d23d8ae2a58688d59af2e721f13fbabc221ddc994928448e70067d/pyindependentreserve-0.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-20 15:30:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MelchiSalins",
"github_project": "pyindependentreserve",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pyindependentreserve"
}