Skip to main content

kucoinfutures-python

Python SDK (sync and async) for Kucoinfutures cryptocurrency exchange with Rest and WS capabilities.

Installation

pip install kucoin-futures-api

Usage

Sync

from kucoinfutures import KucoinfuturesSync

def main():
    instance = KucoinfuturesSync({})
    ob =  instance.fetch_order_book("BTC/USDC")
    print(ob)
    #
    # balance = instance.fetch_balance()
    # order = instance.create_order("BTC/USDC", "limit", "buy", 1, 100000)

main()

Async

import sys
import asyncio
from kucoinfutures import KucoinfuturesAsync

### on Windows, uncomment below:
# if sys.platform == 'win32':
# 	asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

async def main():
    instance = KucoinfuturesAsync({})
    ob =  await instance.fetch_order_book("BTC/USDC")
    print(ob)
    #
    # balance = await instance.fetch_balance()
    # order = await instance.create_order("BTC/USDC", "limit", "buy", 1, 100000)

    # once you are done with the exchange
    await instance.close()

asyncio.run(main())

Websockets

import sys
from kucoinfutures import KucoinfuturesWs

### on Windows, uncomment below:
# if sys.platform == 'win32':
# 	asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

async def main():
    instance = KucoinfuturesWs({})
    while True:
        ob = await instance.watch_order_book("BTC/USDC")
        print(ob)
        # orders = await instance.watch_orders("BTC/USDC")

    # once you are done with the exchange
    await instance.close()

asyncio.run(main())

Raw call

You can also construct custom requests to available "implicit" endpoints

        request = {
            'type': 'candleSnapshot',
            'req': {
                'coin': coin,
                'interval': tf,
                'startTime': since,
                'endTime': until,
            },
        }
        response = await instance.public_post_info(request)

Available methods

REST Unified

  • fetch_bids_asks(self, symbols: Strings = None, params: dict = {})
  • describe(self)
  • transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params: dict = {})

REST Raw

  • public_get_currencies(request)
  • public_get_currencies_currency(request)
  • public_get_symbols(request)
  • public_get_market_orderbook_level1(request)
  • public_get_market_alltickers(request)
  • public_get_market_stats(request)
  • public_get_markets(request)
  • public_get_market_orderbook_level_level_limit(request)
  • public_get_market_orderbook_level2_20(request)
  • public_get_market_orderbook_level2_100(request)
  • public_get_market_histories(request)
  • public_get_market_candles(request)
  • public_get_prices(request)
  • public_get_timestamp(request)
  • public_get_status(request)
  • public_get_mark_price_symbol_current(request)
  • public_get_mark_price_all_symbols(request)
  • public_get_margin_config(request)
  • public_get_announcements(request)
  • public_get_margin_collateralratio(request)
  • public_get_margin_available_inventory(request)
  • public_get_convert_symbol(request)
  • public_get_convert_currencies(request)
  • public_post_bullet_public(request)
  • private_get_user_info(request)
  • private_get_user_api_key(request)
  • private_get_accounts(request)
  • private_get_accounts_accountid(request)
  • private_get_accounts_ledgers(request)
  • private_get_hf_accounts_ledgers(request)
  • private_get_hf_margin_account_ledgers(request)
  • private_get_transaction_history(request)
  • private_get_sub_user(request)
  • private_get_sub_accounts_subuserid(request)
  • private_get_sub_accounts(request)
  • private_get_sub_api_key(request)
  • private_get_margin_account(request)
  • private_get_margin_accounts(request)
  • private_get_isolated_accounts(request)
  • private_get_deposit_addresses(request)
  • private_get_deposits(request)
  • private_get_hist_deposits(request)
  • private_get_withdrawals(request)
  • private_get_hist_withdrawals(request)
  • private_get_withdrawals_quotas(request)
  • private_get_accounts_transferable(request)
  • private_get_transfer_list(request)
  • private_get_base_fee(request)
  • private_get_trade_fees(request)
  • private_get_market_orderbook_level_level(request)
  • private_get_market_orderbook_level2(request)
  • private_get_market_orderbook_level3(request)
  • private_get_hf_accounts_opened(request)
  • private_get_hf_orders_active(request)
  • private_get_hf_orders_active_symbols(request)
  • private_get_hf_margin_order_active_symbols(request)
  • private_get_hf_orders_done(request)
  • private_get_hf_orders_orderid(request)
  • private_get_hf_orders_client_order_clientoid(request)
  • private_get_hf_orders_dead_cancel_all_query(request)
  • private_get_hf_fills(request)
  • private_get_orders(request)
  • private_get_limit_orders(request)
  • private_get_orders_orderid(request)
  • private_get_order_client_order_clientoid(request)
  • private_get_fills(request)
  • private_get_limit_fills(request)
  • private_get_stop_order(request)
  • private_get_stop_order_orderid(request)
  • private_get_stop_order_queryorderbyclientoid(request)
  • private_get_oco_order_orderid(request)
  • private_get_oco_order_details_orderid(request)
  • private_get_oco_client_order_clientoid(request)
  • private_get_oco_orders(request)
  • private_get_hf_margin_orders_active(request)
  • private_get_hf_margin_orders_done(request)
  • private_get_hf_margin_orders_orderid(request)
  • private_get_hf_margin_orders_client_order_clientoid(request)
  • private_get_hf_margin_fills(request)
  • private_get_hf_margin_stop_orders(request)
  • private_get_hf_margin_stop_order_orderid(request)
  • private_get_hf_margin_stop_order_clientoid(request)
  • private_get_hf_margin_oco_order_orderid(request)
  • private_get_hf_margin_oco_order_clientoid(request)
  • private_get_hf_margin_oco_order_detail_orderid(request)
  • private_get_hf_margin_oco_orders(request)
  • private_get_etf_info(request)
  • private_get_margin_currencies(request)
  • private_get_risk_limit_strategy(request)
  • private_get_isolated_symbols(request)
  • private_get_margin_symbols(request)
  • private_get_isolated_account_symbol(request)
  • private_get_margin_borrow(request)
  • private_get_margin_repay(request)
  • private_get_margin_interest(request)
  • private_get_margin_borrowrate(request)
  • private_get_project_list(request)
  • private_get_project_marketinterestrate(request)
  • private_get_redeem_orders(request)
  • private_get_purchase_orders(request)
  • private_get_broker_api_rebase_download(request)
  • private_get_broker_querymycommission(request)
  • private_get_broker_queryuser(request)
  • private_get_broker_querydetailbyuid(request)
  • private_get_migrate_user_account_status(request)
  • private_get_convert_quote(request)
  • private_get_convert_order_detail(request)
  • private_get_convert_order_history(request)
  • private_get_convert_limit_quote(request)
  • private_get_convert_limit_order_detail(request)
  • private_get_convert_limit_orders(request)
  • private_get_affiliate_inviter_statistics(request)
  • private_get_affiliate_queryinvitees(request)
  • private_get_affiliate_querymycommission(request)
  • private_get_affiliate_querytransactionbyuid(request)
  • private_get_affiliate_querytransactionbytime(request)
  • private_get_affiliate_querykumining(request)
  • private_post_sub_user_created(request)
  • private_post_sub_api_key(request)
  • private_post_sub_api_key_update(request)
  • private_post_deposit_addresses(request)
  • private_post_withdrawals(request)
  • private_post_accounts_universal_transfer(request)
  • private_post_accounts_sub_transfer(request)
  • private_post_accounts_inner_transfer(request)
  • private_post_transfer_out(request)
  • private_post_transfer_in(request)
  • private_post_hf_orders(request)
  • private_post_hf_orders_test(request)
  • private_post_hf_orders_sync(request)
  • private_post_hf_orders_multi(request)
  • private_post_hf_orders_multi_sync(request)
  • private_post_hf_orders_alter(request)
  • private_post_hf_orders_dead_cancel_all(request)
  • private_post_orders(request)
  • private_post_orders_test(request)
  • private_post_orders_multi(request)
  • private_post_stop_order(request)
  • private_post_oco_order(request)
  • private_post_hf_margin_order(request)
  • private_post_hf_margin_order_test(request)
  • private_post_hf_margin_stop_order(request)
  • private_post_margin_order(request)
  • private_post_margin_order_test(request)
  • private_post_hf_margin_oco_order(request)
  • private_post_margin_borrow(request)
  • private_post_margin_repay(request)
  • private_post_purchase(request)
  • private_post_redeem(request)
  • private_post_lend_purchase_update(request)
  • private_post_convert_order(request)
  • private_post_convert_limit_order(request)
  • private_post_bullet_private(request)
  • private_post_position_update_user_leverage(request)
  • private_post_deposit_address_create(request)
  • private_delete_sub_api_key(request)
  • private_delete_withdrawals_withdrawalid(request)
  • private_delete_hf_orders_orderid(request)
  • private_delete_hf_orders_sync_orderid(request)
  • private_delete_hf_orders_client_order_clientoid(request)
  • private_delete_hf_orders_sync_client_order_clientoid(request)
  • private_delete_hf_orders_cancel_orderid(request)
  • private_delete_hf_orders(request)
  • private_delete_hf_orders_cancelall(request)
  • private_delete_orders_orderid(request)
  • private_delete_order_client_order_clientoid(request)
  • private_delete_orders(request)
  • private_delete_stop_order_orderid(request)
  • private_delete_stop_order_cancelorderbyclientoid(request)
  • private_delete_stop_order_cancel(request)
  • private_delete_oco_order_orderid(request)
  • private_delete_oco_client_order_clientoid(request)
  • private_delete_oco_orders(request)
  • private_delete_hf_margin_orders_orderid(request)
  • private_delete_hf_margin_orders_client_order_clientoid(request)
  • private_delete_hf_margin_orders(request)
  • private_delete_hf_margin_stop_order_cancel_by_id(request)
  • private_delete_hf_margin_stop_order_cancel_by_clientoid(request)
  • private_delete_hf_margin_stop_order_cancel(request)
  • private_delete_hf_margin_oco_order_cancel_by_id(request)
  • private_delete_hf_margin_oco_order_cancel_by_clientoid(request)
  • private_delete_hf_margin_oco_order_cancel(request)
  • private_delete_convert_limit_order_cancel(request)
  • futurespublic_get_contracts_active(request)
  • futurespublic_get_contracts_symbol(request)
  • futurespublic_get_ticker(request)
  • futurespublic_get_alltickers(request)
  • futurespublic_get_level2_snapshot(request)
  • futurespublic_get_level2_depth20(request)
  • futurespublic_get_level2_depth100(request)
  • futurespublic_get_trade_history(request)
  • futurespublic_get_kline_query(request)
  • futurespublic_get_interest_query(request)
  • futurespublic_get_index_query(request)
  • futurespublic_get_mark_price_symbol_current(request)
  • futurespublic_get_premium_query(request)
  • futurespublic_get_trade_statistics(request)
  • futurespublic_get_funding_rate_symbol_current(request)
  • futurespublic_get_contract_funding_rates(request)
  • futurespublic_get_timestamp(request)
  • futurespublic_get_status(request)
  • futurespublic_get_level2_message_query(request)
  • futurespublic_get_contracts_risk_limit_symbol(request)
  • futurespublic_get_level3_message_query(request)
  • futurespublic_get_level3_snapshot(request)
  • futurespublic_post_bullet_public(request)
  • futuresprivate_get_transaction_history(request)
  • futuresprivate_get_account_overview(request)
  • futuresprivate_get_account_overview_all(request)
  • futuresprivate_get_transfer_list(request)
  • futuresprivate_get_orders(request)
  • futuresprivate_get_stoporders(request)
  • futuresprivate_get_recentdoneorders(request)
  • futuresprivate_get_orders_orderid(request)
  • futuresprivate_get_orders_byclientoid(request)
  • futuresprivate_get_fills(request)
  • futuresprivate_get_recentfills(request)
  • futuresprivate_get_trade_fees(request)
  • futuresprivate_get_openorderstatistics(request)
  • futuresprivate_get_position(request)
  • futuresprivate_get_positions(request)
  • futuresprivate_get_margin_maxwithdrawmargin(request)
  • futuresprivate_get_contracts_risk_limit_symbol(request)
  • futuresprivate_get_funding_history(request)
  • futuresprivate_get_copy_trade_futures_get_max_open_size(request)
  • futuresprivate_get_copy_trade_futures_position_margin_max_withdraw_margin(request)
  • futuresprivate_get_history_positions(request)
  • futuresprivate_get_position_getmarginmode(request)
  • futuresprivate_get_position_getpositionmode(request)
  • futuresprivate_get_deposit_address(request)
  • futuresprivate_get_deposit_list(request)
  • futuresprivate_get_withdrawals_quotas(request)
  • futuresprivate_get_withdrawal_list(request)
  • futuresprivate_get_sub_api_key(request)
  • futuresprivate_get_trade_statistics(request)
  • futuresprivate_get_getmaxopensize(request)
  • futuresprivate_get_getcrossuserleverage(request)
  • futuresprivate_post_transfer_out(request)
  • futuresprivate_post_transfer_in(request)
  • futuresprivate_post_orders(request)
  • futuresprivate_post_st_orders(request)
  • futuresprivate_post_orders_test(request)
  • futuresprivate_post_orders_multi(request)
  • futuresprivate_post_position_margin_auto_deposit_status(request)
  • futuresprivate_post_margin_withdrawmargin(request)
  • futuresprivate_post_position_margin_deposit_margin(request)
  • futuresprivate_post_position_risk_limit_level_change(request)
  • futuresprivate_post_copy_trade_futures_orders(request)
  • futuresprivate_post_copy_trade_futures_orders_test(request)
  • futuresprivate_post_copy_trade_futures_st_orders(request)
  • futuresprivate_post_copy_trade_futures_position_margin_deposit_margin(request)
  • futuresprivate_post_copy_trade_futures_position_margin_withdraw_margin(request)
  • futuresprivate_post_copy_trade_futures_position_risk_limit_level_change(request)
  • futuresprivate_post_copy_trade_futures_position_margin_auto_deposit_status(request)
  • futuresprivate_post_copy_trade_futures_position_changemarginmode(request)
  • futuresprivate_post_copy_trade_futures_position_changecrossuserleverage(request)
  • futuresprivate_post_copy_trade_getcrossmodemarginrequirement(request)
  • futuresprivate_post_copy_trade_position_switchpositionmode(request)
  • futuresprivate_post_changecrossuserleverage(request)
  • futuresprivate_post_withdrawals(request)
  • futuresprivate_post_sub_api_key(request)
  • futuresprivate_post_sub_api_key_update(request)
  • futuresprivate_post_position_changemarginmode(request)
  • futuresprivate_post_position_switchpositionmode(request)
  • futuresprivate_post_bullet_private(request)
  • futuresprivate_delete_orders_orderid(request)
  • futuresprivate_delete_orders_client_order_clientoid(request)
  • futuresprivate_delete_orders(request)
  • futuresprivate_delete_stoporders(request)
  • futuresprivate_delete_copy_trade_futures_orders(request)
  • futuresprivate_delete_copy_trade_futures_orders_client_order(request)
  • futuresprivate_delete_orders_multi_cancel(request)
  • futuresprivate_delete_withdrawals_withdrawalid(request)
  • futuresprivate_delete_cancel_transfer_out(request)
  • futuresprivate_delete_sub_api_key(request)
  • webexchange_get_currency_currency_chain_info(request)
  • webexchange_get_contract_symbol_funding_rates(request)
  • broker_get_broker_nd_info(request)
  • broker_get_broker_nd_account(request)
  • broker_get_broker_nd_account_apikey(request)
  • broker_get_broker_nd_rebase_download(request)
  • broker_get_broker_nd_mark_up(request)
  • broker_get_asset_ndbroker_deposit_list(request)
  • broker_get_broker_nd_transfer_detail(request)
  • broker_get_broker_nd_deposit_detail(request)
  • broker_get_broker_nd_withdraw_detail(request)
  • broker_post_broker_nd_transfer(request)
  • broker_post_broker_nd_account(request)
  • broker_post_broker_nd_account_apikey(request)
  • broker_post_broker_nd_account_update_apikey(request)
  • broker_post_broker_nd_mark_up(request)
  • broker_delete_broker_nd_account_apikey(request)
  • earn_get_otc_loan_discount_rate_configs(request)
  • earn_get_otc_loan_loan(request)
  • earn_get_otc_loan_accounts(request)
  • earn_get_earn_redeem_preview(request)
  • earn_get_earn_saving_products(request)
  • earn_get_earn_hold_assets(request)
  • earn_get_earn_promotion_products(request)
  • earn_get_earn_kcs_staking_products(request)
  • earn_get_earn_staking_products(request)
  • earn_get_earn_eth_staking_products(request)
  • earn_get_struct_earn_dual_products(request)
  • earn_get_struct_earn_orders(request)
  • earn_post_earn_orders(request)
  • earn_post_struct_earn_orders(request)
  • earn_delete_earn_orders(request)
  • uta_get_market_announcement(request)
  • uta_get_market_currency(request)
  • uta_get_asset_currencies(request)
  • uta_get_market_instrument(request)
  • uta_get_market_ticker(request)
  • uta_get_market_trade(request)
  • uta_get_market_kline(request)
  • uta_get_market_funding_rate(request)
  • uta_get_market_funding_rate_history(request)
  • uta_get_market_cross_config(request)
  • uta_get_market_collateral_discount_ratio(request)
  • uta_get_market_index_price(request)
  • uta_get_market_position_tiers(request)
  • uta_get_market_open_interest(request)
  • uta_get_server_status(request)
  • uta_get_market_borrowable_currency(request)
  • uta_get_user_my_ip(request)
  • uta_get_market_fiat_price(request)
  • utav2_get_market_funding_rate(request)
  • utaprivate_get_market_orderbook(request)
  • utaprivate_get_account_balance(request)
  • utaprivate_get_account_transfer_quota(request)
  • utaprivate_get_account_mode(request)
  • utaprivate_get_account_ledger(request)
  • utaprivate_get_account_interest_history(request)
  • utaprivate_get_asset_deposit_address(request)
  • utaprivate_get_account_deposit_address(request)
  • utaprivate_get_accountmode_account_balance(request)
  • utaprivate_get_accountmode_account_overview(request)
  • utaprivate_get_accountmode_order_detail(request)
  • utaprivate_get_accountmode_order_open_list(request)
  • utaprivate_get_accountmode_order_history(request)
  • utaprivate_get_accountmode_order_execution(request)
  • utaprivate_get_accountmode_position_open_list(request)
  • utaprivate_get_accountmode_position_history(request)
  • utaprivate_get_position_history(request)
  • utaprivate_get_accountmode_position_tiers(request)
  • utaprivate_get_sub_account_balance(request)
  • utaprivate_get_user_fee_rate(request)
  • utaprivate_get_dcp_query(request)
  • utaprivate_get_unified_account_leverage(request)
  • utaprivate_get_position_funding_history(request)
  • utaprivate_get_account_interest_limits(request)
  • utaprivate_post_account_transfer(request)
  • utaprivate_post_account_mode(request)
  • utaprivate_post_accountmode_account_modify_leverage(request)
  • utaprivate_post_accountmode_order_place(request)
  • utaprivate_post_accountmode_order_place_batch(request)
  • utaprivate_post_accountmode_order_cancel(request)
  • utaprivate_post_accountmode_order_cancel_batch(request)
  • utaprivate_post_accountmode_order_cancel_all(request)
  • utaprivate_post_sub_account_cantransferout(request)
  • utaprivate_post_dcp_set(request)
  • utaprivate_post_accountmode_account_modify_leverage_margin_cross(request)

WS Unified

  • describe(self)
  • fetch_bids_asks(self, symbols: Strings = None, params: dict = {})
  • transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params: dict = {})

Contribution

  • Give us a star ⭐
  • Fork and Clone! Awesome
  • Select existing issues or create a new issue.

Metadata

Release files for kucoin-futures-api 0.0.169

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kucoin-futures-api 0.0.169
File Size Uploaded Provenance Actions
kucoin_futures_api-0.0.169.tar.gz 253.3 kB Without provenance Details for kucoin_futures_api-0.0.169.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kucoin-futures-api 0.0.169
File Interpreter ABI Platform Actions
kucoin_futures_api-0.0.169-py3-none-any.whl Python 3 none any Details for kucoin_futures_api-0.0.169-py3-none-any.whl

Total release size: 546.9 kB

Release files / kucoin_futures_api-0.0.169.tar.gz

Download URL kucoin_futures_api-0.0.169.tar.gz
Size 253.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9d58146041a4d8295c6945c26b97ca8b3acd15f5016f538a4eca0189c0226a92
BLAKE2b-256 checksum
How to use checksums
6cc35fcd576af5517b6bfc9b86f69842d59fe463f46126b98f5f394c415ea7a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / kucoin_futures_api-0.0.169-py3-none-any.whl

Download URL kucoin_futures_api-0.0.169-py3-none-any.whl
Size 293.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e51013b016c5ebf3daa0f277c0c3ec94c87395b2825b1ddf24db3a8b33808a31
BLAKE2b-256 checksum
How to use checksums
0aa5b0abce25acee8359882dc6aa4567c9415548396b46ee3e93fbc343c48a64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for kucoin-futures-api 0.0.169

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.169 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page