10000 GitHub - LeoThern/pionex_python: pionex to python, unofficial wrapper for the pionex api
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

pionex to python, unofficial wrapper for the pionex api

License

Notifications You must be signed in to change notification settings

LeoThern/pionex_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
< 9C70 div class="react-directory-truncate">requirements.txt
 
 

Repository files navigation

Pionex to Python

pip install pionex_python

Description

Connector library for Pionex Restful and Websocket api. Closely resembles PionexAPI Docs for intuitive implementation. All function names are identical to the endpoints in the documentation.

Examples

rest public

from pionex_python.restful.Common import Common

commonClient = Common()
market_data = commonClient.market_data()

print(market_data)

rest private

from pionex_python.restful.Orders import Orders

key, secret = 'X...X', 'X...X'

ordersClient = Orders(key, secret)

order = {
    'symbol':'BTC_USDT',
    'side':'BUY',
    'type':'MARKET',
    'amount':'16',
}

response = ordersClient.new_order(order=order)
print(response)
Multiple Order Template
from pionex_python.restful.Orders import Orders

key, secret = 'X...X', 'X...X'

ordersClient = Orders(key, secret)

orders = [
  {
  'side':'BUY',
  'type':'LIMIT',
  'price':'57200',
  'size':'0.0002'
  },{
  'side':'SELL',
  'type':'LIMIT',
  'price':'60000',
  'size':'0.0002'
  }
]

response = ordersClient.new_multiple_order(symbol='BTC_USDT',orders=orders)
print(response)

Websocket

from pionex_python.websocket.PublicStream import PublicStream
from time import sleep

#stream = PrivateStream(key, secret)
stream = PublicStream()

def onMessage(msg):
    print(msg)

stream.subscribe(callback=onMessage, topic='TRADE',symbol='BTC_USDT')
stream.subscribe(callback=onMessage, topic='TRADE',symbol='ETH_USDT')
sleep(5)
stream.unsubscribe(topic='TRADE',symbol='BTC_USDT')
stream.unsubscribe(topic='TRADE',symbol='ETH_USDT')

Motivation

  • learn the python packaging and publishing systems
  • implement a python websocket client
  • increase experience with marketplace apis

About

pionex to python, unofficial wrapper for the pionex api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0