Coinbase Pro Deposit USD from Linked Bank Account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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