Client.get_accounts() only gives certain cryptos for output

If i give my API right to all the accounts, it seems to only find certain ones, ETH for example, is not one of them. If i give my API the right to only access my ETH account it finds it fine. Thankful for any help!

Update:
When API accesses all accounts, programm seems to just find the ones i have never touched, meaning they have no transaction history. Here is the code i am trying to use.

import requests
from bs4 import BeautifulSoup
import urllib.request, urllib.parse, urllib.error
from coinbase.wallet.client import Client
from sec import api_key, api_sec


client = Client(api_key, api_sec)
acounts = client.get_accounts()
print(acounts)
for x in acounts.data:
    print(x.balance.currency)
ids= []
for wallet in acounts.data:
    if len(wallet.get('id'))<10:
        continue
    id = wallet.get('id')
    ids.append(id)
    #print(ids)
#print(ids)
for id in ids:
#    user = client.get_addresses(id)
#    print(user)
    txs = client.get_transactions(id)
    for tx in txs.data:
        print(tx, '\n\n\n')
        if float(tx.amount.amount)!=0:
            print(tx.amount.currency)
            print(tx.amount.amount)
#            print(tx.created_at)
            print('\n\n\n\n\n')
        #break

Hello @Kaur! Thank you for taking an interest in trying out Coinbase APIs. For the details regarding your concern, we will check on this for you with our team. We will get back to you once we have more information. Keep in touch!

1 Like

Hi @Kaur! In order for us to further investigate the case, can we confirm what Coinbase Cloud API are you trying to use?

We appreciate your patience as we continue to resolve this issue. Thank you!

1 Like

Hi!
I am trying to use the query client.get_accounts(), where the api i am using is the one i generated in my coinbase account. The response only gives the following accounts: GFI, REP, CRV, BADGER, COMP, CTSI, FOX, ALCX, USDT, DDX, BLZ, FX, TRAC, BAL, IMX, JASMY, SNX, IDEX, SUSHI, PAX, POWR, MIR, BNT, POLS, COVAl. I don’t have a transaction history with any of these. On the other hand, with currencies such as ETH and BTC, which I do have a history with, the query doesn’t seem to find those. All this happens when my API has access to all the accounts. If given access to just a few, only ETH and BTC for example, it finds those two with ease.

Thank you for your time.

Hi @Kaur, we’ve already notified our team about this. We will get back to you once we have more information. Thank you for your patience and understanding.

Hi @kaur! Thank you for your patience as we continue to resolve your issue.

The reason why you’re not seeing BTC and ETH when selecting all wallets is due to your GET request getting paginated. By default, order is set desc and limit is set to 25. BTC and ETH wallets are the first wallets to be added by default. This must be the reason why, when you select all wallets, the response list only contains the wallets that are lastly added.

Adding pagination parameters will solve your issue as it can increase the limit up to 100. Additionally, you may opt to change the order to ascending from the default value of returning the entries in descending order. You may learn more about pagination here.

We hope this helps.

3 Likes

Thanks a lot! Got all those problems solved. I do however wonder how one would get more than a 100 responses, but that isn’t really important, as i am only interested in the most popular currencies.

I thought i would let you know, that if I make the get request .get_spot_price, the response is always the following:
"amount": "20252.63", "base": "BTC", "currency": "USD"
the “currency” stays “USD”, even if i input currency = ‘EUR’, but the value does change to the currency i ask for.

Again thanks a lot for your response, would have never stumbled on paginations myself!

Hi @Kaur! We’re always happy to help! Please reach out in the future if you need anything else.

With regards to your concern on making a request to the Get Spot Price Endpoint, turns out our team was able to hit this endpoint, and we’ve got a valid response. It appears that the endpoint is working as expected.

You may attempt to make a request once again. If the issue still persists, we’ll need you to provide us with a screenshot showing the issue as this will be helpful to further investigate your concern.

Thank you for your continued support with Coinbase APIs.

1 Like

Hi @judy.absalon! Thanks for responding. I am happy to provide more information.
When running the following code you get two different outputs for the .get requests, however they should be the same.

from coinbase.wallet.client import Client
from sec import api_key, api_sec

client = Client(api_key, api_sec)
faulty = client.get_spot_price(currency = 'EUR')
working = client.get_spot_price(currency_pair = 'BTC-EUR')

print(faulty)
print(working)

The output of this code is the following:

{
  "amount": "20402.98",
  "base": "BTC",
  "currency": "USD"
}
{
  "amount": "20018.19",
  "base": "BTC",
  "currency": "EUR"
}

The problems seems to occur when using the parameter ‘currency =’ , but if you use ‘currency_pair’ = then it works fine. In my previous post i mentioned, that the price did change accordingly, but that doesn’t seem to actually be the case. As seen from the output the prices are different, although i requested them both in ‘EUR’.

Thanks a lot!

Hi @Kaur! You are correct, the problem seems to occur when using the parameter currency . This is because the function get_spot_price has the parameter currency_pair by definition. This has a default argument/value of BTC-USD. This means that if you call the function without passing through any arguments, you will be able to successfully call the API and get the spot price of BTC in terms of USD.

And so, if you want to query for BTC-EUR, you will need to use the currency_pair parameter, instead of currency.

It’ll look like: client.get_spot_price(currency_pair = 'BTC-EUR')

Consequently, you can also just input EUR alone as the argument for the currency_pair parameter for the API to return all supported currencies that can convert to/from EUR.

This will then look like: client.get_spot_price('EUR').

Hope this helps. Thank you!

4 Likes