Python client for the BitMart Cloud API.
- Provides exchange quick trading API
- Easier withdrawal
- Efficiency, higher speeds, and lower latencies
- Priority in development and maintenance
- Dedicated and responsive technical support
- Provide webSocket apis calls
-
1.Python 3.6+ support
-
2.Clone
git clone https://github.com/bitmartexchange/bitmart-python-sdk-api.git
pip3 install -r requirements.txt
- 3.Copy
mv bitmart-python-sdk-api/bitmart /Your Working Directory
- An example of a spot trade API
- Replace it with your own API KEY
- Run
from bitmart.api_spot import APISpot
if __name__ == '__main__':
api_key = "Your API KEY"
secret_key = "Your Secret KEY"
memo = "Your Memo"
spotAPI = APISpot(api_key, secret_key, memo, timeout=(3, 10))
spotAPI.post_submit_limit_buy_order('BTC_USDT', size='0.01', price='8800')
from bitmart import cloud_consts
from bitmart.cloud_ws_client import CloudWSClient
from bitmart.ws_spot import create_channel, create_spot_subscribe_params
class WSTest(CloudWSClient):
def on_message(self, message):
print(f'[ReceiveServerMessage]-------->{message}')
if __name__ == '__main__':
ws = WSTest(api_key="Your API KEY", secret_key="Your Secret KEY", memo="Your Memo")
ws.set_debug(True)
channels = [
# public channel
create_channel(cloud_consts.WS_PUBLIC_SPOT_TICKER, 'BTC_USDT'),
create_channel(cloud_consts.WS_PUBLIC_SPOT_KLINE_1M, 'BTC_USDT'),
create_channel(cloud_consts.WS_PUBLIC_SPOT_DEPTH5, 'BTC_USDT'),
# private channel
create_channel(cloud_consts.WS_USER_SPOT_ORDER, 'BTC_USDT')
]
ws.spot_subscribe_with_login(create_spot_subscribe_params(channels))
** 2020-07-16
- Interface Spot API
Cancel Order
update to v2 version that isPOST https://api-cloud.bitmart.com/spot/v2/cancel_order
- UserAgent set "BitMart-Java-SDK/1.0.1"
** 2020-09-21
- Interface Spot API
/spot/v1/symbols/book
addsize
parameter, which represents the number of depths