Git Product home page Git Product logo

bitmart-python-sdk-api's Introduction

Logo

BitMart-Python-SDK-API

Build Status

Python client for the BitMart Cloud API.

Feature

  • 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

Installation

  • 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

Usage

  • An example of a spot trade API
  • Replace it with your own API KEY
  • Run

API Example

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')

WebSocket Public Channel Example

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(cloud_consts.WS_URL, "", "", "")
    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')
    ]

    ws.spot_subscribe_without_login(create_spot_subscribe_params(channels))

WebSocket Private Channel Example

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(cloud_consts.WS_URL_USER, api_key="Your API KEY", secret_key="Your Secret KEY", memo="Your Memo")
    ws.set_debug(True)
    channels = [
        # private channel
        create_channel(cloud_consts.WS_USER_SPOT_ORDER, 'BTC_USDT')
    ]

    ws.spot_subscribe_with_login(create_spot_subscribe_params(channels))

Release Notes

** 2020-07-16

  • Interface Spot API Cancel Order update to v2 version that is POST 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 add size parameter, which represents the number of depths

** 2021-01-19

  • New endpoints for Spot WebSocket
    • Public - ticket channels
    • Public - K channel
    • Public - trading channels
    • Public - depth channels
    • Login
    • User - Trading Channel

** 2021-11-06

  • Update endpoints for Spot WebSocket
    • Public-Depth Channel:
      • spot/depth20 20 Level Depth Channel
      • spot/depth50 50 Level Depth Channel
    • User-Trade Channel:
      • Eligible pushes add new orders successfully

** 2021-11-24

  • New endpoints for Spot
    • /spot/v2/ordersGet User Order History V2
    • /spot/v1/batch_ordersBatch Order
  • Update endpoints for Spot
    • /spot/v1/symbols/klineAdd new field 'quote_volume'
    • /spot/v1/symbols/tradesAdd optional parameter N to return the number of items, the default is up to 50 items
    • /spot/v1/order_detailAdd new field 'unfilled_volume'
    • /spot/v1/submit_orderThe request parameter type added limit_maker and ioc order types
  • New endpoints for Account
    • /account/v2/deposit-withdraw/historyGet Deposit And Withdraw History V2
  • Update endpoints for Account
    • /account/v1/walletRemove the account_type,Only respond to currency accounts; you can bring currency parameters (optional)

** 2022-01-18

  • websocket public channel addresswss://ws-manager-compress.bitmart.com?protocol=1.1will be taken down on 2022-02-28 UTC time,The new address iswss://ws-manager-compress.bitmart.com/api?protocol=1.1

** 2022-01-20

  • Update endpoints for Spot
    • /spot/v1/symbols/detailsAdd a new respond parameter trade_status, to show the trading status of a trading pair symbol.

License

bitmart-python-sdk-api's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.