kucoin-python-sdk
kucoin-python-sdk copied to clipboard
ImportError: cannot import name 'Client' from 'kucoin.client' (/home/pi/venv/lib/python3.9/site-packages/kucoin/client.py)
Can any one help me please!
this is the error msg i am getting
(venv) pi@raspberrypi:~/workspace/usdtNAKA $ python3 naka.py
Traceback (most recent call last):
File "/home/pi/workspace/usdtNAKA/naka.py", line 2, in
this is the code
import time from kucoin.client import Client from kucoin.ws_token.token import GetToken # You may need to fix this import if necessary from gmail import GMail, Message
Initialize Gmail
gmail = GMail('[email protected]', 'xxxxxxxxxx')
KuCoin API key and secret
api_key = 'xxxxxxxxxxxxxxxx' api_secret = 'xxxxxxxxxxxxxxx' api_passphrase = 'xxxxxxxxx'
Amount to invest per interval
invest = 100
Interval time in hours
interval_time = 24
Initialize KuCoin client
client = Client(api_key, api_secret, api_passphrase)
Rest of the code ............
There is no class called Client
in kucoin.client
. See kucoin/client.py
.
Try:
import kucoin.client as kcc
print("\n".join(dir(kcc))) # print a list of module contents
and you'll get User
, Trade
, Market
, Margin
, WsToken
(and some other things).
Then I use:
# Market:
market = kcc.Market(
key="012345678901234567890123",
secret="deadbeef-dead-beef-dead-beefdeadbeef",
passphrase="super-strong-password",
is_sandbox=False,
)
ticker = market.get_ticker("SOMETOKEN-USDT")
print(ticker)
day_stats = market.get_24h_stats("SOMETOKEN-USDT")
print(day_stats)
# User
usr = kcc.User(...) # same kwargs as for Market
acc = usr.get_account_list(account_type="trade")
print(acc)
As described by @zannen , please try updating to the latest version of the SDK and modify your code to try again. If you encounter any issues, feel free to provide feedback.