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"
# is_json is a boolean type. If True, the Content-Type is `application/json`.
# Otherwise, it is `application/x-www-form-urlencoded`.
client = BlockHttpClient(
sign_method=sign_method,
api_key=api_key,
api_secret=api_secret,
base_url=base_url,
log_level=logging.DEBUG,
is_json=True
)
# 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
File details
Details for the file lbank-connector-python-1.0.137.tar.gz
.
File metadata
- Download URL: lbank-connector-python-1.0.137.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 363a129a546e18525633f2c770af0f4d79a71c9ae904cdbb88c4749fcb5cd5f8 |
|
MD5 | fe885e29b2f97832c77bf1becc862d8b |
|
BLAKE2b-256 | c08b19908b7530474b05b351c59d3c09ac931d4760ede9c4213ca902537c4b33 |
File details
Details for the file lbank_connector_python-1.0.137-py3-none-any.whl
.
File metadata
- Download URL: lbank_connector_python-1.0.137-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf6f7afa5211cd337361e9b9bea04bb33531976f86221890bb1b5f51094fd82b |
|
MD5 | fb4321bb33c15f76de629fce48956c3b |
|
BLAKE2b-256 | 4d8f6795ab44a44fded8a5d5e35081e4961d98c45cf871916662332b230c7aac |