Skip to main content

kucoinfutures crypto exchange api client

Project description

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={})
  • describe(self)
  • transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={})

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_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_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_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_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_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)
  • 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={})
  • transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={})

Contribution

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

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_api-0.0.131.tar.gz (688.7 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_api-0.0.131-py3-none-any.whl (955.6 kB view details)

Uploaded Python 3

File details

Details for the file kucoin_futures_api-0.0.131.tar.gz.

File metadata

  • Download URL: kucoin_futures_api-0.0.131.tar.gz
  • Upload date:
  • Size: 688.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for kucoin_futures_api-0.0.131.tar.gz
Algorithm Hash digest
SHA256 49175f558b2c214a33393a4759601f883fb6f91ff123c09c2f132073934b51a1
MD5 a849330b6001978c5a62742dfe1f5285
BLAKE2b-256 864393725ca44b0b5354a54756faebb3f26bb2355058bc3375d736ff8c3ac65b

See more details on using hashes here.

File details

Details for the file kucoin_futures_api-0.0.131-py3-none-any.whl.

File metadata

File hashes

Hashes for kucoin_futures_api-0.0.131-py3-none-any.whl
Algorithm Hash digest
SHA256 8a685683b3e85f10cfd3b8f50a2732494c9beefa123b30a0f6fde4d6008320b0
MD5 a7da7dac3c8dcffcd1515d243c30b2ac
BLAKE2b-256 3733a3edf9279941ebbda826713723f690482897ed8b1c73115f65da69221415

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