Get fees rates and 30 days trailing volume

Does anyone have a script to recover fees rates and 30 days trailing volume; thank you veru much.

You can use Get Transactions Summary endpoint:
https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_gettransactionsummary

thank you very much, but i still without solution for this :frowning:
this is my script but returns : Status Code: 401, Reason: Unauthorized
RĂ©ponse brute : Unauthorized

def create_signature(api_secret, timestamp, method, request_path, body=‘’):
message = timestamp + method + request_path + body
hmac_key = base64.b64decode(api_secret)
signature = hmac.new(hmac_key, message.encode(‘utf-8’), hashlib.sha256)
signature_b64 = base64.b64encode(signature.digest()).decode()
return signature_b64

def get_transaction_summary(api_key, api_secret):
timestamp = str(int(time.time()))
method = “GET”
request_path = “/api/v3/brokerage/transaction_summary”
body = ‘’
signature = create_signature(api_secret, timestamp, method, request_path, body)

headers = {
    'CB-ACCESS-SIGN': signature,
    'CB-ACCESS-TIMESTAMP': timestamp,
    'CB-ACCESS-KEY': api_key,
    'CB-VERSION': '2023-11-08',
    'Content-Type': 'application/json',
    'User-Agent': 'My Coinbase App/1.0'
}

print("En-tĂȘtes de la requĂȘte:", headers)
print(f"Signature générée: {signature}")

conn = http.client.HTTPSConnection("api.coinbase.com")
conn.request(method, request_path, body, headers)
res = conn.getresponse()
data = res.read().decode("utf-8")
conn.close()

print(f"Status Code: {res.status}, Reason: {res.reason}")
print(f"RĂ©ponse brute : {data}")

API_KEY = os.getenv(‘COINBASE_API_KEY’)
API_SECRET = os.getenv(‘COINBASE_API_SECRET’)

if API_KEY and API_SECRET:
print(“ExĂ©cution de get_transaction_summary avec les clĂ©s API fournies.”)
get_transaction_summary(API_KEY, API_SECRET)
else:
print(“Les clĂ©s d’API COINBASE n’ont pas Ă©tĂ© trouvĂ©es. Veuillez les configurer comme variables d’environnement.”)
Any help is welcome, thanks in advance !

Please use Preformatted text option for code!

Advanced trade secret is not base64 encoded and signature should not be encoded either.

Thank you !!! you are Great !!!
if any one want the script, i can share.

1 Like