Connector library for Pionex REST and WS api.
Project description
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(onMessage=onMessage, topic='TRADE',symbol='BTC_USDT')
stream.subscribe(onMessage=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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pionex_python-1.1.0.tar.gz
(5.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pionex_python-1.1.0.tar.gz.
File metadata
- Download URL: pionex_python-1.1.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.7 Linux/6.6.107-1-MANJARO
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9513da701ec459dcea161ecc8afb18be091cb3dbcae8a25c0023448c95b8f2df
|
|
| MD5 |
412dd029b819a982afce10b7e28fda0b
|
|
| BLAKE2b-256 |
c08530b5a3641e3dbc6c192e537e93aa17fde7ad53a7266729b94e9e873b2ad4
|
File details
Details for the file pionex_python-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pionex_python-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.7 Linux/6.6.107-1-MANJARO
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4bd8cadbe27415ac29da63dd0cc317b28462221c370b287fa56def62f539557
|
|
| MD5 |
f4734ba58f0492e7376041ba12919df7
|
|
| BLAKE2b-256 |
a161aaecc50c605a57a2f53bda89ce4c8baa7cb4e7fa9bd44d6194d461ca2619
|