Official python3 BitMake exchange API
Project description
BitMake Python3 SDK
This is BitMake Official Python3 SDK
Installation
pip3 install bitmake
Rest Example
from bitmake.rest import BitMakeApiClient
api_client = BitMakeApiClient(api_key='TestApiKey', api_secret='TestSecret')
order_response = api_client.create_order('BTC_USD', 'client_order_123', '10000', '0.01', 'BUY', 'LIMIT', 'GTC')
print(order_response)
Websocket Example
Public Channels
from bitmake.ws import BitMakeWebsocketApiClient, RespData, PushData
ws_client = BitMakeWebsocketApiClient()
await ws_client.connect()
await ws_client.subscribe('diffMergedDepth', {'symbol': 'BTC_USD'}) # subscribe `diffMergedDepth` topic
await ws_client.subscribe('trade', {'symbol': 'BTC_USD'}) # subscribe `trade` topic
while ws_client.connected:
data = await ws_client.recv_data()
assert isinstance(data, RespData) or isinstance(data, PushData)
if isinstance(data, RespData):
# received response data
# for example: RespData{data_type: RespDataType.MARKET_DEPTH, data: {'co': 0, 'm': 'success'}}
print("recv resp data type: {} data: {}".format(data.data_type, data.data))
elif isinstance(data, PushData):
# received push data
# for example: PushData{data_type: PushDataType.MARKET_DEPTH, data: [{'s': 'BTC_USD', 't': 1667874854633, 'vs': 527579119, 've': 527579128, 'b': [['20636', '0.1336'], ['20634', '0.1402']], 'a': [['20649', '0.06'], ['20654', '0.0727']]}]}
print("recv push data type: {} data: {}".format(data.data_type, data.data))
Private Channels
from bitmake.ws import BitMakeWebsocketApiClient, RespData, PushData
ws_client = BitMakeWebsocketApiClient(api_key='TestApiKey', api_secret='TestSecret')
await ws_client.connect()
# Optionally you can subscribe any public topic
# await ws_client.subscribe('diffMergedDepth', {'symbol': 'BTC_USD'}) # subscribe `diffMergedDepth` topic
# await ws_client.subscribe('trade', {'symbol': 'BTC_USD'}) # subscribe `trade` topic
while ws_client.connected:
data = await ws_client.recv_data()
assert isinstance(data, RespData) or isinstance(data, PushData)
if isinstance(data, RespData):
# received response data
# for example: RespData{data_type: RespDataType.MARKET_DEPTH, data: {'co': 0, 'm': 'success'}}
print("recv resp data type: {} data: {}".format(data.data_type, data.data))
elif isinstance(data, PushData):
# received push data
# for example: PushData{data_type: PushDataType.ACCOUNT_BALANCE, data: [{'token': 'USDT', 'available': '40', 'total': '40'}]}
print("recv push data type: {} data: {}".format(data.data_type, data.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
bitmake-1.0.1.tar.gz
(9.6 kB
view details)
Built Distribution
bitmake-1.0.1-py3-none-any.whl
(11.0 kB
view details)
File details
Details for the file bitmake-1.0.1.tar.gz
.
File metadata
- Download URL: bitmake-1.0.1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
3654b1dfe7af4a37ff5b9d2c132ae460619bde2b04c6c726377d4cfe4a25e478
|
|
MD5 |
2bc3a9bb6aab940a5a6414e0abee93a5
|
|
BLAKE2b-256 |
5a9f3aae5578af1a06f4f7d0d821d8a35d7773af905c827357f8bb263ebbb106
|
File details
Details for the file bitmake-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: bitmake-1.0.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
d6fc6e9bf85163dfbc5e25801a92811701312cb7ebe62cccb09259260c939cd5
|
|
MD5 |
a337f52d9dd541d877d64e2799232602
|
|
BLAKE2b-256 |
7bcc5875355534291705acf39ad0122120230e7a22d6f9f60be6699976e4b73a
|