Skip to content

Api client for XeggeX exchange written in async python

Notifications You must be signed in to change notification settings

xeggex/XeggeXPythonApiClient

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

README stub

This is the python API client for XeggeX exchange API. Reference link

Api Keys

To use account endpoints and login to the websocket enerate api keys and put them in xeggex_settings.json in the working directory. If you don't you'll still be able to use public methods.

xeggex_settings.json format:

{"access_key": "your_access_key_here", "secret_key": "your_secret_key_here"}

Examples in apython console (pip install apython)

Using public methods

>>> from xeggex import XeggeXClient
>>> x = XeggeXClient()
>>> await x.get_assets()

Using private methods, (xeggegs_settings.json required)

>>> from xeggex import XeggeXClient
>>> x = XeggeXClient()
>>> await x.get_balances()

Websocket subscriptions

>>> from xeggex import XeggeXClient
>>> x = XeggeXClient()
>>> async def main():
...     async with x.websocket_context() as ws:
...         async for msg in x.subscribe_trades_generator(ws,'XRG/USDT'):
...             print(msg)
... 
>>> await main()

Websocket private subscriptions, (xeggegs_settings.json required):

>>> from xeggex import XeggeXClient
>>> x = XeggeXClient()
>>> async def main():
...     async with x.websocket_context() as ws:
...         await x.ws_login(ws)
...         async for msg in x.subscribe_reports_generator(ws):
...             print(msg)
... 
>>> await main()

Websocket public metods

>>> from xeggex import XeggeXClient
>>> x = XeggeXClient()
>>> 
... async with x.websocket_context() as ws:
...     data = await x.ws_get_asset(ws, 'XRG')

Websocket private metods, (xeggegs_settings.json required)

>>> from xeggex import XeggeXClient
>>> x = XeggeXClient()
>>> 
... async with x.websocket_context() as ws:
...     await x.ws_login(ws)
...     data = await x.ws_get_active_orders(ws)

Reading multiple streams at once

>>> from lib.clients.xeggex import XeggeXClient
>>> x = XeggeXClient()
>>> async with x.websocket_context() as ws:
...     xrg_trades = [
...         x.subscribe_trades_generator(ws, 'DOGE/USDT'),
...         x.subscribe_trades_generator(ws, 'LTC/USDT')
...     ]
...     async for msg in x.combine_streams(xrg_trades):
...         print(msg['params']['data'])
... 

Examples

Run immediate_or_cancel_example.py according to the instruction in help. python immediate_or_cancell_example.py --help

Contrinuting

Generate documentation:

pdoc --html --output-dir docs --config show_source_code=False --force xeggex.py

About

Api client for XeggeX exchange written in async python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%