J'ai fait le code source en m’aidant de la documentation,
from coinbase.wallet.client import Client
client = Client(
<clé publique>,
<clé privée>,
api_version='2018-03-09')
account = client.get_primary_account()
payment_method = client.get_payment_methods()[0]
sell_price_threshold = 1000000000 # voluntary set an unattainable price for automatically sell all coins in wallet
sell_price = client.get_sell_price(currency='EUR')
if float(sell_price.amount) <= sell_price_threshold:
sell = account.sell(amount='acct.balance.amount',
currency="BTC, LTC, ETH, BCH",
payment_method=payment_method.id)
Les premieres lignes fonctionnent normal dans la console, mais quand je tape ca :
client.get_primary_account()
Ils me donnent cette erreur :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'client' is not defined