Giter Club home page Giter Club logo

kucoin-futures-python-sdk's Introduction

Welcome to kucoin-futures-python-sdk

https://img.shields.io/badge/python-3.6%2B-green

Features

  • Implementation of REST endpoints
  • Simple handling of authentication
  • Response exception handling
  • Implement websockets (note only python3.6+)

update

  • 2024 02/07
  1. trade.get_public_funding_history: Get Public Funding History.
  2. trade.get_24h_futures_transaction_volume: Get 24-hour platform futures trading volume.
  3. trade.cancel_order_by_clientOid: Cancel Order by clientOid.
  4. customized websocket: ./kucoin_futures/example_customized_ws_private.py | kucoin_futures/example_customized_ws_public.py.
  • sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
  1. set api TCP_NODELAY:After instantiating the client, you can cancel the Nagle algorithm through client.TCP_NODELAY=1 (default is 0)
  • kucoin/example_client_TCP_NODELAY.py

Quick Start

Register an account with KuCoin_Futures.

To test on the Sandbox with KuCoin_Futures Sandbox.

Generate an API Key or Generate an API Key in Sandbox and enable it. Note:API key can only be generated after logging in.

pip install kucoin-futures-python
#  MarketData
from kucoin_futures.client import Market
client = Market(url='https://api-futures.kucoin.com')
# client = Market()
# or connect to Sandbox
# client = Market(url='https://api-sandbox-futures.kucoin.com')
# client = Market(is_sandbox=True)

# get l3_order_book
l3_depth = client.l3_order_book('XBTUSDM')

# get l2_order_book
l2_depth = client.l2_order_book('XBTUSDM')

# get symbol ticker
klines = client.get_ticker("XBTUSDM")

# get symbol ticker
server_time = client.get_server_timestamp()

api_key = '<api_key>'
api_secret = '<api_secret>'
api_passphrase = '<api_passphrase>'

# Trade
from kucoin_futures.client import Trade
client = Trade(key='', secret='', passphrase='', is_sandbox=False, url='')

# or connect to Sandbox
# client = Trade(api_key, api_secret, api_passphrase, is_sandbox=True)

# place a limit buy order
order_id = client.create_limit_order('XBTUSDM', 'buy', '1', '30', '8600')

# place a market buy order   Use cautiously
order_id = client.create_market_order('XBTUSDM', 'buy', '1')

# cancel limit order
client.cancel_order('5bd6e9286d99522a52e458de')

# cancel all limit order
client.cancel_all_limit_order('XBTUSDM')

# User
from kucoin_futures.client import User
client = User(api_key, api_secret, api_passphrase)

# or connect to Sandbox
# client = User(api_key, api_secret, api_passphrase, is_sandbox=True)

address = client.get_withdrawal_quota('XBT')

Websockets

  • ./kucoin_futures/example_customized_ws_private.py
  • ./kucoin_futures/example_customized_ws_public.py
  • ./kucoin_futures/example_default_ws_public.py

kucoin-futures-python-sdk's People

Contributors

1bazinga25 avatar codewc avatar elidioxg avatar ive20 avatar jasonyao2107 avatar

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.