· 4 years ago · Jul 31, 2021, 10:02 PM
1from binance.client import Client
2
3try:
4 client = Client(input('Your API Key: '), input('Your secret key: '))
5except Exception as e:
6 print('Error: ', e)
7
8# Step 1:
9for i in client.get_account()['balances']:
10 print(i['asset']+': \nfree:', i['free'], '\nlocked: ', i['locked'], '\n')
11
12# Step 3:
13
14# Step 4:
15
16while True:
17 if input('Would you like to do a withdrawal? ') != 'y':
18 break
19 amount = float(input('How much would you like to withdraw? '))
20 asset = input('What asset would you like to withdraw? ')
21 address = input('Where would you like to send the money? ')
22 try:
23 client.withdraw(asset=asset, address=address, amount=amount)
24 except Exception as e:
25 print('Error: ', e)
26 print('Please try again.')
27 else:
28 print('Withdrawal complete.')
29