Skip to content

Instantly share code, notes, and snippets.

Last active September 2, 2022 15:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rhettre/3d6fcf428fca4bb5badafa7454b28761 to your computer and use it in GitHub Desktop.
Withdraw From Gemini to One Address
import json
import gemini
import random
import math
public_key = ""
private_key = ""
trader = gemini.PrivateClient(public_key, private_key)
#withdraws full available balance of specified coin to given address
def _withdrawFullCoinBalance(coin, address):
amount = "0"
for currency in trader.get_balance():
if(currency['currency'] == coin):
amount_before_fee = float(currency['availableForWithdrawal'])
print(f'Amount Available for Withdrawal: {amount_before_fee}')
#set your fee variable to whatever the corresponding coin is
fee = float(.0001)
amount_to_withdrawal = str(math.floor((amount_before_fee-fee)*(10**8))/10**8)
withdraw = trader.withdraw_to_address(coin, address, amount_to_withdrawal)
return amount_to_withdrawal
def lambda_handler(event, context):
#Edit these addresses to whatever you want
btc_BlockFi = ''
btc_multisig = ''
btc_multisig2 = ''
#Add the addresses to this list
btc_addresses = [btc_BlockFi,btc_multisig, btc_multisig2, btc_multisig3]
eth_BlockFi = ''
eth_addresses = [eth_BlockFi]
btc_withdraw = _withdrawFullCoinBalance(coin_to_withdrawal, random.choice(btc_addresses))
return {
'statusCode': 200,
'body': json.dumps(f'End of Script')
Copy link

rhettre commented Jul 28, 2022

withdraw-bitcoin withdraws all your available to withdraw BTC and ETH from Gemini. It takes a public and private API KEY + public key BTC and ETH wallet addresses as strings in the btc_addresses + eth_addresses variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment