Skip to main content

Kucoin Futures wrapper library

Project description

Kucoin Futures Library

Installation

pip install kucoin-futures-lib

Class Structure

classDiagram

namespace kucoin_futures_lib {
    class KucoinFutures["KucoinFutures"]
    class KucoinFuturesMarket["KucoinFuturesMarket"]
    class KucoinFuturesTrade["KucoinFuturesTrade"]
    class KucoinFuturesUser["KucoinFuturesUser"]
    class KucoinFuturesWebsocket["KucoinFuturesWebsocket"]
    class KucoinFuturesHelper["KucoinFuturesHelper"]
    class EntryRangeHandler["handlers.EntryRangeHandler"]
    class OcoHandler["handlers.OcoHandler"]
}
namespace kucoin_futures {
    class Market["client.Market"]
    class Trade["client.Trade"]
    class User["client.User"]
    class WsToken["client.WsToken"]
    class KucoinFuturesWsClient["ws_client.KucoinFuturesWsClient"]
}
KucoinFutures o-- KucoinFuturesMarket
KucoinFutures o-- KucoinFuturesTrade
KucoinFutures o-- KucoinFuturesUser
KucoinFutures o-- KucoinFuturesWebsocket
KucoinFuturesMarket o-- Market
KucoinFuturesTrade o-- Trade
KucoinFuturesUser o-- User
KucoinFuturesWebsocket o-- WsToken
KucoinFuturesWebsocket o-- KucoinFuturesWsClient
KucoinFuturesWebsocket o-- EntryRangeHandler
KucoinFuturesWebsocket o-- OcoHandler

Usage Examples

from kucoin_futures_lib import initialize_kucoinf
from kucoin_futures_lib.utils import retriable

retriable = retriable(retries=3, exceptions=(Exception,), backoff_base=2.0, initial_backoff=0.1)

kucoinf = initialize_kucoinf(
    api_key='your-api-key',
    api_secret='your-api-secret',
    api_passphrase='your-api-passphrase',
    retriable=retriable,  # Optional retriable method to retry methods in the library
)

balance = kucoinf.user.get_balance(currency='USDT')
print(f"Account balance: {balance}")


current_price  = kucoinf.market.get_current_price(instrument='XBTUSDTM')
print(f"Current price: {current_price}")

# Create a market order with limit take profit, market stop loss and enable Oco
order_id = kucoinf.create_order(
    instrument="XBTUSDTM",
    side="buy",
    size=3,
    take_profit=75000,
    stop_loss=60000,
    leverage=10,
    enable_oco=True,
)
print(f"Order ID: {order_id}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kucoin_futures_lib-0.13.0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kucoin_futures_lib-0.13.0-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file kucoin_futures_lib-0.13.0.tar.gz.

File metadata

  • Download URL: kucoin_futures_lib-0.13.0.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1018-azure

File hashes

Hashes for kucoin_futures_lib-0.13.0.tar.gz
Algorithm Hash digest
SHA256 cc60b4366be2fc8cdce6c34d4581ba1ee23d113b584efb6ad6a4dbf359601a78
MD5 616fe79fcce38416dd19429603869235
BLAKE2b-256 c6f911354ae87582a2c4ff3237fb1dd4590baf054aeba32934a42de996c1aece

See more details on using hashes here.

File details

Details for the file kucoin_futures_lib-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: kucoin_futures_lib-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1018-azure

File hashes

Hashes for kucoin_futures_lib-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2774fb7977b1b4b9ce9a7f9e315147ca5c158ddb3d6e56a221be02910e40e3f8
MD5 c2c6afca333aa6f109625460369fd902
BLAKE2b-256 bce74fa629ae55a4d1f27673626ef31271d56ad81774e2a5d151deb90dadcbc7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page