This is the python API client for XeggeX exchange API. Reference link
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"}
>>> 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()
>>> 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()
>>> 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)
>>> 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'])
...
Run immediate_or_cancel_example.py
according to the instruction in help. python immediate_or_cancell_example.py --help
Generate documentation:
pdoc --html --output-dir docs --config show_source_code=False --force xeggex.py