.. image:: https://img.shields.io/pypi/l/python-kucoin :target: https://github.com/Kucoin/kucoin-python-sdk/blob/master/LICENSE
.. image:: https://img.shields.io/badge/python-3.6%2B-green :target: https://pypi.org/project/python-kucoin
.. role:: red :class: red
.. raw:: html
<style>
.red {color:IndianRed;}
</style>
2024 08/19
2024 07/25
2024 07/07
2024 02/26
Get Interest Rates <https://www.kucoin.com/docs/rest/margin-trading/lending-market-v3-/get-interest-rates>
.2024 02/19
Get HF Filled List <https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/get-hf-filled-list>
The trade.get_hf_transaction_records method will be removed at some time in the future
Get HF Completed order list <https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/get-hf-completed-order-list>
The trade.get_filled_hf_order method will be removed at some time in the future
2024 02/07
Get Leveraged Token Info <https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-leveraged-token-info>
.Get Account Detail - Cross Margin <https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-cross-margin>
.Get Account Detail - Isolated Margin <https://www.kucoin.com/docs/rest/funding/funding-overview/get-account-detail-isolated-margin>
.Get Cross/Isolated Margin Risk Limit/Currency config <https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-cross-isolated-margin-risk-limit-currency-config>
.Place Order <https://www.kucoin.com/docs/rest/spot-trading/oco-order/place-order>
.Cancel Order by orderId <https://www.kucoin.com/docs/rest/spot-trading/oco-order/cancel-order-by-orderid>
.Cancel Order by clientOid <https://www.kucoin.com/docs/rest/spot-trading/oco-order/cancel-order-by-clientoid>
.Cancel Multiple Orders <https://www.kucoin.com/docs/rest/spot-trading/oco-order/cancel-multiple-orders>
.Get Order Info by orderId <https://www.kucoin.com/docs/rest/spot-trading/oco-order/get-order-info-by-orderid>
.Get Order Info by clientOid <https://docs.kucoin.com/spot-hf/#obtain-details-of-a-single-hf-order-using-clientoid>
.Get Order List <https://www.kucoin.com/docs/rest/spot-trading/oco-order/get-order-list>
.Get Order Details by orderId <https://www.kucoin.com/docs/rest/spot-trading/oco-order/get-order-details-by-orderid>
.Cancel all HF orders <https://www.kucoin.com/docs/rest/spot-trading/spot-hf-trade-pro-account/cancel-all-hf-orders>
.Register an account with KuCoin <https://www.kucoin.com/ucenter/signup>
_.
Generate an API Key <https://www.kucoin.com/account/api>
_ and enable it.
.. code:: bash
pip install kucoin-python
.. code:: python
# MarketData
from kucoin.client import Market
client = Market(url='https://api.kucoin.com')
# client = Market()
# get symbol kline
klines = client.get_kline('BTC-USDT','1min')
# get symbol ticker
server_time = client.get_server_timestamp()
api_key = '<api_key>'
api_secret = '<api_secret>'
api_passphrase = '<api_passphrase>'
# Trade
from kucoin.client import Trade
client = Trade(key='', secret='', passphrase='', url='')
# place a limit buy order
order_id = client.create_limit_order('BTC-USDT', 'buy', '1', '8000')
# place a market buy order Use cautiously
order_id = client.create_market_order('BTC-USDT', 'buy', size='1')
# cancel limit order
client.cancel_order('5bd6e9286d99522a52e458de')
# User
from kucoin.client import User
client = User(api_key, api_secret, api_passphrase)
address = client.get_withdrawal_quota('KCS')