https://github.com/ape364/aioidex
Idex API async Python wrapper
https://github.com/ape364/aioidex
api-client async exchange-api idex python python3 websockets websockets-client
Last synced: 5 months ago
JSON representation
Idex API async Python wrapper
- Host: GitHub
- URL: https://github.com/ape364/aioidex
- Owner: ape364
- Created: 2019-04-27T10:04:21.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T05:41:09.000Z (over 3 years ago)
- Last Synced: 2025-12-22T01:29:59.652Z (6 months ago)
- Topics: api-client, async, exchange-api, idex, python, python3, websockets, websockets-client
- Language: Python
- Size: 65.4 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# aioidex
[](https://pypi.org/project/aioidex/)
[](https://pypi.org/project/aioidex/)
[](https://travis-ci.com/ape364/aioidex)
[](https://coveralls.io/github/ape364/aioidex)
[](https://pypi.org/project/aioidex/)
[Idex](https://idex.market/) [API](https://docs.idex.market/) async Python non-official wrapper. Tested only with Python 3.7.
## Features
### REST API
Supports only [public read-only endpoints](https://docs.idex.market/#group/HTTP-API) at this moment.
### Datastream Realtime API
Full [Datastream realtime API](https://docs.idex.market/#tag/Datastream-Introduction) support (via [websockets](https://github.com/aaugustin/websockets)).
## Installation
```sh
pip install -U aioidex
```
## Usage
### Datastream
```python
import asyncio
from aioidex import IdexDatastream, MarketEvents, MarketSubscription, ChainSubscription, ChainEvents
def get_subs():
return [
MarketSubscription([MarketEvents.ORDERS], ['ETH_AURA', 'ETH_KIN']),
ChainSubscription([ChainEvents.SERVER_BLOCK]),
]
async def main():
ds = IdexDatastream()
for sub in get_subs():
await ds.sub_manager.subscribe(sub)
# # init connection manually
# await ds.init()
# # or pass an already exists connection
# ws = await ds.create_connection()
# await ds.init(ws)
# or simply start to listen, connection will be created automatically
async for msg in ds.listen():
print(msg)
if __name__ == '__main__':
asyncio.run(main())
```
### HTTP
```python
import asyncio
from aioidex import Client
async def main():
c = Client()
try:
result = await c.public.ticker()
except Exception as e:
print(f'Error ({type(e).__name__}): {e}')
else:
print(result)
finally:
await c.close()
if __name__ == '__main__':
asyncio.run(main())
```