Crypto backtesting
Loading...
Searching...
No Matches
cb.py
Go to the documentation of this file.
1from coinbase.wallet.client import Client
2import os
3
4# Set your API key and secret key here.
5api_key = os.getenv('COINBASE_API_KEY')
6api_secret = os.getenv('COINBASE_API_SECRET')
7
8try:
9 print("get accounts")
10 client = Client(api_key, api_secret)
11 accounts = client.get_accounts()
12
13 for account in accounts['data']:
14 print("Fetching orders for account:", account['name'])
15 transactions = client.get_transactions(account['id'])
16 for transaction in transactions['data']:
17 print("Order ID: ", transaction['id'],
18 "Amount: ", transaction['amount']['amount'],
19 "Currency: ", transaction['amount']['currency'])
20
21except Exception as e:
22 print(e)
23