python-kucoin icon indicating copy to clipboard operation
python-kucoin copied to clipboard

KucoinAPIException 400003: KC-API-KEY not exists

Open BaseMax opened this issue 3 years ago • 1 comments

from kucoin.client import Client

api_key = 'xxxxxxxxxxxxxxxxxxxxxxxx'
api_secret = 'xxxxxxxxxxxxxxxxxxxxxxxx'
api_passphrase = 'xxxxxxxxxxxxxxxxxxxxxxxx'

client = Client(api_key, api_secret, api_passphrase)
# client = Client(api_key, api_secret, api_passphrase, sandbox=True)

# get currencies
currencies = client.get_currencies()
print(currencies)

# open a new order
order = client.create_market_order('KCS', Client.SIDE_BUY, size=5)
print(order)

image

Error

Traceback (most recent call last):
  File "C:\Users\MAX\Documents\trade.py", line 15, in <module>
    order = client.create_market_order('KCS', Client.SIDE_BUY, size=5)
  File "C:\Users\MAX\AppData\Local\Programs\Python\Python310\lib\site-packages\kucoin\client.py", line 942, in create_market_order
    return self._post('orders', True, data=data)
  File "C:\Users\MAX\AppData\Local\Programs\Python\Python310\lib\site-packages\kucoin\client.py", line 192, in _post
    return self._request('post', path, signed, api_version, **kwargs)
  File "C:\Users\MAX\AppData\Local\Programs\Python\Python310\lib\site-packages\kucoin\client.py", line 160, in _request
    return self._handle_response(response)
  File "C:\Users\MAX\AppData\Local\Programs\Python\Python310\lib\site-packages\kucoin\client.py", line 170, in _handle_response
    raise KucoinAPIException(response)
kucoin.exceptions.KucoinAPIException: KucoinAPIException 400003: KC-API-KEY not exists

Why it's not possible to open a new order?

Thank you for any kind of help in advance.

BaseMax avatar May 30 '22 17:05 BaseMax

In your account, delete your API-KEY and create agian

besides, for the following command: order = client.create_market_order('KCS', Client.SIDE_BUY, size=5)

i think you should define pair of KCS, for example: order = client.create_market_order('KCS-USDT', Client.SIDE_BUY, size=5)

Alireza-Pourreza avatar Jun 25 '22 19:06 Alireza-Pourreza