sammchardy / python-kucoin

Kucoin REST and Websocket API python implementation
https://python-kucoin.readthedocs.io/en/latest/
MIT License
350 stars 148 forks source link

KucoinAPIException 400003: KC-API-KEY not exists #115

Open BaseMax opened 2 years ago

BaseMax commented 2 years ago
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.

Alireza-Pourreza commented 2 years ago

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)