Kucoin Futures wrapper library
Project description
Kucoin Futures Library
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
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
kucoin_futures_lib-0.12.1.tar.gz
(16.1 kB
view hashes)
Built Distribution
Close
Hashes for kucoin_futures_lib-0.12.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 442c6dd671b9ad1a6d6fa29258453868c6ef005a9211257098f88f817aaf8875 |
|
MD5 | 8cf6853cb3ce78c8fdaa97791cc1e883 |
|
BLAKE2b-256 | 3cba0dcaf6fb44a79660a26f97615ff664bf0df1348044646a43b33e0eb43754 |
Close
Hashes for kucoin_futures_lib-0.12.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6204e1ac1cd8b50c3219fa2873501691126e253f7299a79f3a253bc014a026c |
|
MD5 | e62b251ae2002fabba3021057d898fda |
|
BLAKE2b-256 | 56c89cf46300cc55bead05494205318277d64ce7def18d367c66b48d8d6b8e82 |