Skip to content

Api client for NonKYC exchange written in async python

Notifications You must be signed in to change notification settings

NonKYC/NonKycPythonApiClient

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

README stub

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

Api Keys

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

nonkyc_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 nonkyc import NonKYCClient
>>> x = NonKYCClient()
>>> await x.get_assets()

Using private methods, (nonkyc_settings.json required)

>>> from nonkyc import NonKYCClient
>>> x = NonKYCClient()
>>> await x.get_balances()

Websocket subscriptions

>>> from nonkyc import NonKYCClient
>>> x = NonKYCClient()
>>> 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, (nonkyc_settings.json required):

>>> from nonkyc import NonKYCClient
>>> x = NonKYCClient()
>>> 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 nonkyc import NonKYCClient
>>> x = NonKYCClient()
>>> 
... async with x.websocket_context() as ws:
...     data = await x.ws_get_asset(ws, 'XRG')

Websocket private metods, (nonkyc_settings.json required)

>>> from nonkyc import NonKYCClient
>>> x = NonKYCClient()
>>> 
... 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.nonkyc import NonKYCClient
>>> x = NonKYCClient()
>>> 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 nonkyc.py

About

Api client for NonKYC exchange written in async python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%