Skip to content

Instantly share code, notes, and snippets.

@rhettre
Created July 28, 2022 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhettre/cafc7d1e9e9e45b895754ddb839f9e6c to your computer and use it in GitHub Desktop.
Save rhettre/cafc7d1e9e9e45b895754ddb839f9e6c to your computer and use it in GitHub Desktop.
Coinbase Pro Deposit USD from Linked Bank Account
import json
import cbpro
my_key = ''
my_secret = ''
my_passphrase = ''
bank_id = ''
def _depositBTC(deposit_amount, cb_key, cb_secret, cb_password, bank_id):
auth_client = cbpro.AuthenticatedClient(cb_key, cb_secret, cb_password)
deposit = auth_client.deposit(deposit_amount, 'USD', bank_id)
print(deposit)
return deposit_amount
def lambda_handler(event, context):
deposit_amount = 20
message = _depositBTC(deposit_amount, my_key,my_secret,my_passphrase,bank_id)
return {
'statusCode': 200,
'body': json.dumps(f'You deposited ${message} to Coinbase!')
}
@rhettre
Copy link
Author

rhettre commented Jul 28, 2022

deposit-bitcoin lambda_function.py deposits $20 USD into your Coinbase Pro account from your linked bank account once you fill in your API key, secret, and password from Coinbase Pro. You will also need to run the function below to determine what your linked bank_id that you want to deposit from is. Get linked bank info here: https://gist.github.com/rhettre/ed1837ff66b1f00226f545a18550dae6

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