LBANK connector for the public API, private API, and websockets.
Project description
Installation
- pip install --upgrade lbank-connector-python -i https://pypi.org/simple
Contract Call
- You need to apply for the corresponding api_key and api_secret
- The api_key and sign parameters will be encapsulated and added to the request parameters internally, users do not need to worry about it.
- API example
from lbank.old_api import BlockHttpClient
import logging
api_key = ""
api_secret = ""
# service address
base_url = "https://api.lbkex.com/"
# Encryption method
sign_method = "RSA"
client = BlockHttpClient(
sign_method=sign_method,
api_key=api_key,
api_secret=api_secret,
base_url=base_url,
log_level=logging.DEBUG,
)
# Pairs api
api_url = "v2/currencyPairs.do"
res = client.http_request("get", api_url)
print(res)
# withdrawConfigs api
api_url = "v2/withdrawConfigs.do"
payload = {
"assetCode": "btc"
}
res = client.http_request("get", api_url, payload=payload)
print(res)
payload = {}
response = client.http_request("post", "v2/user_info.do", payload=payload)
print(response)
- Websocket example
from lbank.websocket.websocket_client import LbankWebsocketClient
def sub_deep_data():
ws_client = LbankWebsocketClient(
base_url="",
on_message=on_message,
)
subscribe_msg = {
}
ws_client.send(subscribe_msg)
def on_message(ws_client, msg):
print(f"msg:{msg}")
if __name__ == '__main__':
sub_deep_data()
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
Built Distribution
Close
Hashes for lbank-connector-python-1.0.131.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3555acc171c4bf59256772792533a1b7e1e9211561f0cbabd79b7748eaaa3633 |
|
MD5 | 0f126467291e5dec5e59089d2fc968e6 |
|
BLAKE2b-256 | cfe110f6167212cb087274b9835496dd20cd37819af42f4a5b3b3a08893fbbc4 |
Close
Hashes for lbank_connector_python-1.0.131-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 060c6585e648c9590c8980bef887e06bce9d53d09f2c17cc4dd34acb2ca49388 |
|
MD5 | 094c8c26a6c54b05b598318fe80a1b01 |
|
BLAKE2b-256 | 73ff56a1a2e5b70d2ee59f3c69dfc9b53395b12459ff0eb694c209b06d8171a2 |