Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aioidex

PyPi License Build Coveralls Versions

Idex API async Python non-official wrapper. Tested only with Python 3.7.

Features

REST API

Supports only public read-only endpoints at this moment.

Datastream Realtime API

Full Datastream realtime API support (via websockets).

Installation

pip install -U aioidex

Usage

Datastream

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

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())

About

Idex API async Python wrapper

Topics

Resources

Stars

7 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages