Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coinbase advanced; fetch_accounts_v3 pagination doesn't work #22780

Closed
joergkiesewetter opened this issue Jun 11, 2024 · 6 comments
Closed

coinbase advanced; fetch_accounts_v3 pagination doesn't work #22780

joergkiesewetter opened this issue Jun 11, 2024 · 6 comments
Assignees
Labels

Comments

@joergkiesewetter
Copy link

Operating System

mac

Programming Languages

Python

CCXT Version

4.3.42

Description

I want to collect all deposits and withdrawals of my coinbase advanced account. This works for some of them, but for some I get an error:

ccxt.base.errors.ExchangeError: coinbaseadvanced prepareAccountRequestWithCurrencyCode() could not find account id for AGLD

The reason for this is quite simple. In ccxt/coinbase.py:prepare_account_request_with_currency_code we try to find an account id based on the code (line 2557). The called function find_account_id loads all the accounts and tries to find the right account to the given market code.

While loading all accounts, we do paginated requests to load all of them, but here is the problem. The first request is fine, but the second request is not fine. Even giving in the correct cursor, the response is the same as in the first requests. Means, we query the same accounts 10x and the cursor is not working.

This comes form ccxt/base/exchange.py:fetch_paginated_call_cursor:5590.

Hopefully, this makes sense.

Code

  
          deposits = []
          withdrawals = []

          for code in self._client.codes:
            try:
                deposits = deposits + self._client.fetch_deposits(code=code, params={
                    'paginate': True,
                })
                withdrawals = withdrawals + self._client.fetch_withdrawals(code=code, params={
                    'paginate': True,
                })

            except:
                traceback.print_exc()


@sc0Vu sc0Vu self-assigned this Jun 11, 2024
@sc0Vu
Copy link
Contributor

sc0Vu commented Jun 11, 2024

Hi @joergkiesewetter,

The pagination works for me, I used coinbase.py. Would you like to paste logs here?

@sc0Vu sc0Vu added the question label Jun 11, 2024
@joergkiesewetter
Copy link
Author

sure, no problem, I just striped the private data:

this is the log, with logging enabled

DEBUG:ccxt.base.exchange:GET https://api.coinbase.com/api/v3/brokerage/accounts?limit=100, Request: {'Authorization': 'Bearer <>', 'Content-Type': 'application/json', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'CB-VERSION': '2018-05-30'} None
DEBUG:urllib3.connectionpool:https://api.coinbase.com:443 "GET /api/v3/brokerage/accounts?limit=100 HTTP/1.1" 200 None
DEBUG:ccxt.base.exchange:GET https://api.coinbase.com/api/v3/brokerage/accounts?limit=100, Response: 200 {'Date': 'Tue, 11 Jun 2024 11:06:13 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'access-control-allow-headers': 'Content-Type, Accept, Second-Factor-Proof-Token, Client-Id, Access-Token, X-Cb-Project-Name, X-Cb-Is-Logged-In, X-Cb-Platform, X-Cb-Session-Uuid, X-Cb-Pagekey, X-Cb-Ujs, Fingerprint-Tokens, X-Cb-Device-Id, X-Cb-Version-Name', 'access-control-allow-methods': 'GET,POST,DELETE,PUT', 'access-control-allow-private-network': 'true', 'access-control-expose-headers': '', 'access-control-max-age': '7200', 'Cache-Control': 'no-store', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'trace-id': '3185910144807581448, 3185910144807581448', 'vary': 'Origin', 'x-content-type-options': 'nosniff', 'x-dns-prefetch-control': 'off', 'x-download-options': 'noopen', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '1; mode=block', 'x-envoy-upstream-service-time': '55', 'CF-Cache-Status': 'DYNAMIC', 'Server': 'cloudflare', 'CF-RAY': '892121682b8aca68-HAM', 'Content-Encoding': 'gzip'} {"accounts":[{"uuid":"<>", "name":"BIGTIME Wallet", "currency":"BIGTIME"}, {"uuid":"<>", "name":"VARA Wallet", "currency":"VARA"}, {"uuid":"<>", "name":"VET Wallet", "currency":"VET"}, {"uuid":"<>", "name":"VTHO Wallet", "currency":"VTHO"}, {"uuid":"<>", "name":"PYUSD Wallet", "currency":"PYUSD"}, {"uuid":"<>", "name":"SEI Wallet", "currency":"SEI"}, {"uuid":"<>", "name":"HNT Wallet", "currency":"HNT"}, {"uuid":"<>", "name":"SUI Wallet", "currency":"SUI"}, {"uuid":"<>", "name":"T Wallet", "currency":"T"}, {"uuid":"<>", "name":"STG Wallet", "currency":"STG"}, {"uuid":"<>", "name":"SPA Wallet", "currency":"SPA"}, {"uuid":"<>", "name":"XCN Wallet", "currency":"XCN"}, {"uuid":"<>", "name":"WAXL Wallet", "currency":"WAXL"}, {"uuid":"<>", "name":"PRIME Wallet", "currency":"PRIME"}, {"uuid":"<>", "name":"VOXEL Wallet", "currency":"VOXEL"}, {"uuid":"<>", "name":"TVK Wallet", "currency":"TVK"}, {"uuid":"<>", "name":"TIME Wallet", "currency":"TIME"}, {"uuid":"<>", "name":"QI Wallet", "currency":"QI"}, {"uuid":"<>", "name":"MSOL Wallet", "currency":"MSOL"}, {"uuid":"<>", "name":"RARE Wallet", "currency":"RARE"}, {"uuid":"<>", "name":"RPL Wallet", "currency":"RPL"}, {"uuid":"<>", "name":"MONA Wallet", "currency":"MONA"}, {"uuid":"<>", "name":"PYR Wallet", "currency":"PYR"}, {"uuid":"<>", "name":"PUNDIX Wallet", "currency":"PUNDIX"}, {"uuid":"<>", "name":"POND Wallet", "currency":"POND"}, {"uuid":"<>", "name":"PNG Wallet", "currency":"PNG"}, {"uuid":"<>", "name":"OSMO Wallet", "currency":"OSMO"}, {"uuid":"<>", "name":"OOKI Wallet", "currency":"OOKI"}, {"uuid":"<>", "name":"MXC Wallet", "currency":"MXC"}, {"uuid":"<>", "name":"NEAR Wallet", "currency":"NEAR"}, {"uuid":"<>", "name":"MULTI Wallet", "currency":"MULTI"}, {"uuid":"<>", "name":"MNDE Wallet", "currency":"MNDE"}, {"uuid":"<>", "name":"MAGIC Wallet", "currency":"MAGIC"}, {"uuid":"<>", "name":"GAL Wallet", "currency":"GAL"}, {"uuid":"<>", "name":"METIS Wallet", "currency":"METIS"}, {"uuid":"<>", "name":"GHST Wallet", "currency":"GHST"}, {"uuid":"<>", "name":"LSETH Wallet", "currency":"LSETH"}, {"uuid":"<>", "name":"LOKA Wallet", "currency":"LOKA"}, {"uuid":"<>", "name":"APT Wallet", "currency":"APT"}, {"uuid":"<>", "name":"LIT Wallet", "currency":"LIT"}, {"uuid":"<>", "name":"LDO Wallet", "currency":"LDO"}, {"uuid":"<>", "name":"KAVA Wallet", "currency":"KAVA"}, {"uuid":"<>", "name":"INJ Wallet", "currency":"INJ"}, {"uuid":"<>", "name":"ILV Wallet", "currency":"ILV"}, {"uuid":"<>", "name":"HFT Wallet", "currency":"HFT"}, {"uuid":"<>", "name":"HBAR Wallet", "currency":"HBAR"}, {"uuid":"<>", "name":"ACS Wallet", "currency":"ACS"}, {"uuid":"<>", "name":"00 Wallet", "currency":"00"}, {"uuid":"<>", "name":"SYLO Wallet", "currency":"SYLO"}, {"uuid":"<>", "name":"FLR Wallet", "currency":"FLR"}, {"uuid":"<>", "name":"EUROC Wallet", "currency":"EUROC"}, {"uuid":"<>", "name":"EGLD Wallet", "currency":"EGLD"}, {"uuid":"<>", "name":"DYP Wallet", "currency":"DYP"}, {"uuid":"<>", "name":"DIMO Wallet", "currency":"DIMO"}, {"uuid":"<>", "name":"BOBA Wallet", "currency":"BOBA"}, {"uuid":"<>", "name":"DAR Wallet", "currency":"DAR"}, {"uuid":"<>", "name":"AXL Wallet", "currency":"AXL"}, {"uuid":"<>", "name":"BLUR Wallet", "currency":"BLUR"}, {"uuid":"<>", "name":"AURORA Wallet", "currency":"AURORA"}, {"uuid":"<>", "name":"GUSD Wallet", "currency":"GUSD"}, {"uuid":"<>", "name":"AUDIO Wallet", "currency":"AUDIO"}, {"uuid":"<>", "name":"DREP Wallet", "currency":"DREP"}, {"uuid":"<>", "name":"MUSE Wallet", "currency":"MUSE"}, {"uuid":"<>", "name":"C98 Wallet", "currency":"C98"}, {"uuid":"<>", "name":"MEDIA Wallet", "currency":"MEDIA"}, {"uuid":"<>", "name":"GST Wallet", "currency":"GST"}, {"uuid":"<>", "name":"GMT Wallet", "currency":"GMT"}, {"uuid":"<>", "name":"BIT Wallet", "currency":"BIT"}, {"uuid":"<>", "name":"DEXT Wallet", "currency":"DEXT"}, {"uuid":"<>", "name":"FIS Wallet", "currency":"FIS"}, {"uuid":"<>", "name":"ALEPH Wallet", "currency":"ALEPH"}, {"uuid":"<>", "name":"FORT Wallet", "currency":"FORT"}, {"uuid":"<>", "name":"CBETH Wallet", "currency":"CBETH"}, {"uuid":"<>", "name":"ELA Wallet", "currency":"ELA"}, {"uuid":"<>", "name":"ROSE Wallet", "currency":"ROSE"}, {"uuid":"<>", "name":"HIGH Wallet", "currency":"HIGH"}, {"uuid":"<>", "name":"MINA Wallet", "currency":"MINA"}, {"uuid":"<>", "name":"APE Wallet", "currency":"APE"}, {"uuid":"<>", "name":"FLOW Wallet", "currency":"FLOW"}, {"uuid":"<>", "name":"TONE Wallet", "currency":"TONE"}, {"uuid":"<>", "name":"ALICE Wallet", "currency":"ALICE"}, {"uuid":"<>", "name":"INDEX Wallet", "currency":"INDEX"}, {"uuid":"<>", "name":"AERGO Wallet", "currency":"AERGO"}, {"uuid":"<>", "name":"WAMPL Wallet", "currency":"WAMPL"}, {"uuid":"<>", "name":"AIOZ Wallet", "currency":"AIOZ"}, {"uuid":"<>", "name":"MATH Wallet", "currency":"MATH"}, {"uuid":"<>", "name":"SYN Wallet", "currency":"SYN"}, {"uuid":"<>", "name":"PRQ Wallet", "currency":"PRQ"}, {"uuid":"<>", "name":"JUP Wallet", "currency":"JUP"}, {"uuid":"<>", "name":"HOPR Wallet", "currency":"HOPR"}, {"uuid":"<>", "name":"FIDA Wallet", "currency":"FIDA"}, {"uuid":"<>", "name":"ORCA Wallet", "currency":"ORCA"}, {"uuid":"<>", "name":"RNDR Wallet", "currency":"RNDR"}, {"uuid":"<>", "name":"NEST Wallet", "currency":"NEST"}, {"uuid":"<>", "name":"CRPT Wallet", "currency":"CRPT"}, {"uuid":"<>", "name":"QSP Wallet", "currency":"QSP"}, {"uuid":"<>", "name":"KSM Wallet", "currency":"KSM"}, {"uuid":"<>", "name":"SAND Wallet", "currency":"SAND"}, {"uuid":"<>", "name":"GNO Wallet", "currency":"GNO"}, {"uuid":"<>", "name":"OCEAN Wallet", "currency":"OCEAN"}], "has_next":true, "cursor":"<>", "size":100}
DEBUG:ccxt.base.exchange:GET https://api.coinbase.com/api/v3/brokerage/accounts?limit=100&cursor=0c71b133-ee95-5e7a-8b35-242933e454c6, Request: {'Authorization': 'Bearer <>', 'Content-Type': 'application/json', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'CB-VERSION': '2018-05-30'} None
DEBUG:urllib3.connectionpool:https://api.coinbase.com:443 "GET /api/v3/brokerage/accounts?limit=100&cursor=0c71b133-ee95-5e7a-8b35-242933e454c6 HTTP/1.1" 200 None
DEBUG:ccxt.base.exchange:GET https://api.coinbase.com/api/v3/brokerage/accounts?limit=100&cursor=0c71b133-ee95-5e7a-8b35-242933e454c6, Response: 200 {'Date': 'Tue, 11 Jun 2024 11:06:13 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'access-control-allow-headers': 'Content-Type, Accept, Second-Factor-Proof-Token, Client-Id, Access-Token, X-Cb-Project-Name, X-Cb-Is-Logged-In, X-Cb-Platform, X-Cb-Session-Uuid, X-Cb-Pagekey, X-Cb-Ujs, Fingerprint-Tokens, X-Cb-Device-Id, X-Cb-Version-Name', 'access-control-allow-methods': 'GET,POST,DELETE,PUT', 'access-control-allow-private-network': 'true', 'access-control-expose-headers': '', 'access-control-max-age': '7200', 'Cache-Control': 'no-store', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'trace-id': '5881053414653004478, 5881053414653004478', 'vary': 'Origin', 'x-content-type-options': 'nosniff', 'x-dns-prefetch-control': 'off', 'x-download-options': 'noopen', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '1; mode=block', 'x-envoy-upstream-service-time': '79', 'CF-Cache-Status': 'DYNAMIC', 'Server': 'cloudflare', 'CF-RAY': '8921216a1d04ca68-HAM', 'Content-Encoding': 'gzip'} {"accounts":[{"uuid":"<>", "name":"VARA Wallet", "currency":"VARA"}, {"uuid":"<>", "name":"VET Wallet", "currency":"VET"}, {"uuid":"<>", "name":"VTHO Wallet", "currency":"VTHO"}, {"uuid":"<>", "name":"PYUSD Wallet", "currency":"PYUSD"}, {"uuid":"<>", "name":"SEI Wallet", "currency":"SEI"}, {"uuid":"<>", "name":"HNT Wallet", "currency":"HNT"}, {"uuid":"<>", "name":"SUI Wallet", "currency":"SUI"}, {"uuid":"<>", "name":"T Wallet", "currency":"T"}, {"uuid":"<>", "name":"STG Wallet", "currency":"STG"}, {"uuid":"<>", "name":"SPA Wallet", "currency":"SPA"}, {"uuid":"<>", "name":"XCN Wallet", "currency":"XCN"}, {"uuid":"<>", "name":"WAXL Wallet", "currency":"WAXL"}, {"uuid":"<>", "name":"PRIME Wallet", "currency":"PRIME"}, {"uuid":"<>", "name":"VOXEL Wallet", "currency":"VOXEL"}, {"uuid":"<>", "name":"TVK Wallet", "currency":"TVK"}, {"uuid":"<>", "name":"TIME Wallet", "currency":"TIME"}, {"uuid":"<>", "name":"QI Wallet", "currency":"QI"}, {"uuid":"<>", "name":"MSOL Wallet", "currency":"MSOL"}, {"uuid":"<>", "name":"RARE Wallet", "currency":"RARE"}, {"uuid":"<>", "name":"RPL Wallet", "currency":"RPL"}, {"uuid":"<>", "name":"MONA Wallet", "currency":"MONA"}, {"uuid":"<>", "name":"PYR Wallet", "currency":"PYR"}, {"uuid":"<>", "name":"PUNDIX Wallet", "currency":"PUNDIX"}, {"uuid":"<>", "name":"POND Wallet", "currency":"POND"}, {"uuid":"<>", "name":"PNG Wallet", "currency":"PNG"}, {"uuid":"<>", "name":"OSMO Wallet", "currency":"OSMO"}, {"uuid":"<>", "name":"OOKI Wallet", "currency":"OOKI"}, {"uuid":"<>", "name":"MXC Wallet", "currency":"MXC"}, {"uuid":"<>", "name":"NEAR Wallet", "currency":"NEAR"}, {"uuid":"<>", "name":"MULTI Wallet", "currency":"MULTI"}, {"uuid":"<>", "name":"MNDE Wallet", "currency":"MNDE"}, {"uuid":"<>", "name":"MAGIC Wallet", "currency":"MAGIC"}, {"uuid":"<>", "name":"GAL Wallet", "currency":"GAL"}, {"uuid":"<>", "name":"METIS Wallet", "currency":"METIS"}, {"uuid":"<>", "name":"GHST Wallet", "currency":"GHST"}, {"uuid":"<>", "name":"LSETH Wallet", "currency":"LSETH"}, {"uuid":"<>", "name":"LOKA Wallet", "currency":"LOKA"}, {"uuid":"<>", "name":"APT Wallet", "currency":"APT"}, {"uuid":"<>", "name":"LIT Wallet", "currency":"LIT"}, {"uuid":"<>", "name":"LDO Wallet", "currency":"LDO"}, {"uuid":"<>", "name":"KAVA Wallet", "currency":"KAVA"}, {"uuid":"<>", "name":"INJ Wallet", "currency":"INJ"}, {"uuid":"<>", "name":"ILV Wallet", "currency":"ILV"}, {"uuid":"<>", "name":"HFT Wallet", "currency":"HFT"}, {"uuid":"<>", "name":"HBAR Wallet", "currency":"HBAR"}, {"uuid":"<>", "name":"ACS Wallet", "currency":"ACS"}, {"uuid":"<>", "name":"00 Wallet", "currency":"00"}, {"uuid":"<>", "name":"SYLO Wallet", "currency":"SYLO"}, {"uuid":"<>", "name":"FLR Wallet", "currency":"FLR"}, {"uuid":"<>", "name":"EUROC Wallet", "currency":"EUROC"}, {"uuid":"<>", "name":"EGLD Wallet", "currency":"EGLD"}, {"uuid":"<>", "name":"DYP Wallet", "currency":"DYP"}, {"uuid":"<>", "name":"DIMO Wallet", "currency":"DIMO"}, {"uuid":"<>", "name":"BOBA Wallet", "currency":"BOBA"}, {"uuid":"<>", "name":"DAR Wallet", "currency":"DAR"}, {"uuid":"<>", "name":"AXL Wallet", "currency":"AXL"}, {"uuid":"<>", "name":"BLUR Wallet", "currency":"BLUR"}, {"uuid":"<>", "name":"AURORA Wallet", "currency":"AURORA"}, {"uuid":"<>", "name":"GUSD Wallet", "currency":"GUSD"}, {"uuid":"<>", "name":"AUDIO Wallet", "currency":"AUDIO"}, {"uuid":"<>", "name":"DREP Wallet", "currency":"DREP"}, {"uuid":"<>", "name":"MUSE Wallet", "currency":"MUSE"}, {"uuid":"<>", "name":"C98 Wallet", "currency":"C98"}, {"uuid":"<>", "name":"MEDIA Wallet", "currency":"MEDIA"}, {"uuid":"<>", "name":"GST Wallet", "currency":"GST"}, {"uuid":"<>", "name":"GMT Wallet", "currency":"GMT"}, {"uuid":"<>", "name":"BIT Wallet", "currency":"BIT"}, {"uuid":"<>", "name":"DEXT Wallet", "currency":"DEXT"}, {"uuid":"<>", "name":"FIS Wallet", "currency":"FIS"}, {"uuid":"<>", "name":"ALEPH Wallet", "currency":"ALEPH"}, {"uuid":"<>", "name":"FORT Wallet", "currency":"FORT"}, {"uuid":"<>", "name":"CBETH Wallet", "currency":"CBETH"}, {"uuid":"<>", "name":"ELA Wallet", "currency":"ELA"}, {"uuid":"<>", "name":"ROSE Wallet", "currency":"ROSE"}, {"uuid":"<>", "name":"HIGH Wallet", "currency":"HIGH"}, {"uuid":"<>", "name":"MINA Wallet", "currency":"MINA"}, {"uuid":"<>", "name":"APE Wallet", "currency":"APE"}, {"uuid":"<>", "name":"FLOW Wallet", "currency":"FLOW"}, {"uuid":"<>", "name":"TONE Wallet", "currency":"TONE"}, {"uuid":"<>", "name":"ALICE Wallet", "currency":"ALICE"}, {"uuid":"<>", "name":"INDEX Wallet", "currency":"INDEX"}, {"uuid":"<>", "name":"AERGO Wallet", "currency":"AERGO"}, {"uuid":"<>", "name":"WAMPL Wallet", "currency":"WAMPL"}, {"uuid":"<>", "name":"AIOZ Wallet", "currency":"AIOZ"}, {"uuid":"<>", "name":"MATH Wallet", "currency":"MATH"}, {"uuid":"<>", "name":"SYN Wallet", "currency":"SYN"}, {"uuid":"<>", "name":"PRQ Wallet", "currency":"PRQ"}, {"uuid":"<>", "name":"JUP Wallet", "currency":"JUP"}, {"uuid":"<>", "name":"HOPR Wallet", "currency":"HOPR"}, {"uuid":"<>", "name":"FIDA Wallet", "currency":"FIDA"}, {"uuid":"<>", "name":"ORCA Wallet", "currency":"ORCA"}, {"uuid":"<>", "name":"RNDR Wallet", "currency":"RNDR"}, {"uuid":"<>", "name":"NEST Wallet", "currency":"NEST"}, {"uuid":"<>", "name":"CRPT Wallet", "currency":"CRPT"}, {"uuid":"<>", "name":"QSP Wallet", "currency":"QSP"}, {"uuid":"<>", "name":"KSM Wallet", "currency":"KSM"}, {"uuid":"<>", "name":"SAND Wallet", "currency":"SAND"}, {"uuid":"<>", "name":"GNO Wallet", "currency":"GNO"}, {"uuid":"<>", "name":"OCEAN Wallet", "currency":"OCEAN"}, {"uuid":"<>", "name":"GFI Wallet", "currency":"GFI"}], "has_next":true, "cursor":"c3f795bd-4f85-59f0-b4a1-e8aa866e3abe", "size":100}
DEBUG:ccxt.base.exchange:GET https://api.coinbase.com/api/v3/brokerage/accounts?limit=100&cursor=c3f795bd-4f85-59f0-b4a1-e8aa866e3abe, Request: {'Authorization': 'Bearer <>', 'Content-Type': 'application/json', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'CB-VERSION': '2018-05-30'} None
DEBUG:urllib3.connectionpool:https://api.coinbase.com:443 "GET /api/v3/brokerage/accounts?limit=100&cursor=c3f795bd-4f85-59f0-b4a1-e8aa866e3abe HTTP/1.1" 200 None

and this is the error message I get, when the account could not be found:

Traceback (most recent call last):
  File ".//provider/coinbasepro.py", line 66, in get_transactions
    deposits = deposits + self._client.fetch_deposits(code=code, params={
  File "./venv/lib/python3.8/site-packages/ccxt/coinbase.py", line 776, in fetch_deposits
    return self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdDeposits', code, since, limit, params)
  File "./venv/lib/python3.8/site-packages/ccxt/coinbase.py", line 747, in fetch_transactions_with_method
    request, params = self.prepare_account_request_with_currency_code(code, limit, params)
  File "./venv/lib/python3.8/site-packages/ccxt/coinbase.py", line 2559, in prepare_account_request_with_currency_code
    raise ExchangeError(self.id + ' prepareAccountRequestWithCurrencyCode() could not find account id for ' + code)
ccxt.base.errors.ExchangeError: coinbaseadvanced prepareAccountRequestWithCurrencyCode() could not find account id for 1INCH

maybe also interesting, this is the way how I initialize the client:

        self._client = ccxt.coinbaseadvanced({
            'apiKey':          api_key,
            'secret':          api_secret,
            'enableRateLimit': True,
            'options':         {
                'adjustForTimeDifference': True,
            },
        })

@carlosmiei
Copy link
Collaborator

carlosmiei commented Jun 11, 2024

@joergkiesewetter Coinbase requires an account ID to fetch deposits, and each account represents a currency.

If you get that error, it probably means you don't have an account ID for that currency, but you can debug it by doing so.

await coinbase.load_accounts()
print(coinbase.accounts)

can you check if for instance ALGD exists in this dictionary?

endpoint used: https://docs.cdp.coinbase.com/sign-in-with-coinbase/docs/api-deposits/#list-deposits

@joergkiesewetter
Copy link
Author

@carlosmiei indeed, ALGD is not in the list of accounts.

When I just execute your command, I get a list of 100 accounts associated to my cb-account. So, when I enable pagination, I get a list of 1,000 accounts, but each account is in there 10 times, like:

{'id': '<>', 'type': 'wallet', 'code': 'NEST', 'info': {'uuid': '<>', 'name': 'NEST Wallet', 'currency': 'NEST', 'available_balance': {'value': '0', 'currency': 'NEST'}, 'default': True, 'active': True, 'created_at': '2023-05-29T19:25:30.809Z', 'updated_at': '2023-05-29T19:25:30.809Z', 'deleted_at': None, 'type': 'ACCOUNT_TYPE_CRYPTO', 'ready': True, 'hold': {'value': '0', 'currency': 'NEST'}, 'retail_portfolio_id': '<>'}}, 
{'id': '<>', 'type': 'wallet', 'code': 'NEST', 'info': {'uuid': '<>', 'name': 'NEST Wallet', 'currency': 'NEST', 'available_balance': {'value': '0', 'currency': 'NEST'}, 'default': True, 'active': True, 'created_at': '2023-05-29T19:25:30.809Z', 'updated_at': '2023-05-29T19:25:30.809Z', 'deleted_at': None, 'type': 'ACCOUNT_TYPE_CRYPTO', 'ready': True, 'hold': {'value': '0', 'currency': 'NEST'}, 'retail_portfolio_id': '<>'}, 'cursor': '0c71b133-ee95-5e7a-8b35-242933e454c6'}, 
{'id': '<>', 'type': 'wallet', 'code': 'NEST', 'info': {'uuid': '<>', 'name': 'NEST Wallet', 'currency': 'NEST', 'available_balance': {'value': '0', 'currency': 'NEST'}, 'default': True, 'active': True, 'created_at': '2023-05-29T19:25:30.809Z', 'updated_at': '2023-05-29T19:25:30.809Z', 'deleted_at': None, 'type': 'ACCOUNT_TYPE_CRYPTO', 'ready': True, 'hold': {'value': '0', 'currency': 'NEST'}, 'retail_portfolio_id': '<>'}, 'cursor': 'c3f795bd-4f85-59f0-b4a1-e8aa866e3abe'}, 
{'id': '<>', 'type': 'wallet', 'code': 'NEST', 'info': {'uuid': '<>', 'name': 'NEST Wallet', 'currency': 'NEST', 'available_balance': {'value': '0', 'currency': 'NEST'}, 'default': True, 'active': True, 'created_at': '2023-05-29T19:25:30.809Z', 'updated_at': '2023-05-29T19:25:30.809Z', 'deleted_at': None, 'type': 'ACCOUNT_TYPE_CRYPTO', 'ready': True, 'hold': {'value': '0', 'currency': 'NEST'}, 'retail_portfolio_id': '<>'}, 'cursor': '1c8ba0c2-80fe-5e3f-9770-1155ddc62ee0'}, 
{'id': '<>', 'type': 'wallet', 'code': 'NEST', 'info': {'uuid': '<>', 'name': 'NEST Wallet', 'currency': 'NEST', 'available_balance': {'value': '0', 'currency': 'NEST'}, 'default': True, 'active': True, 'created_at': '2023-05-29T19:25:30.809Z', 'updated_at': '2023-05-29T19:25:30.809Z', 'deleted_at': None, 'type': 'ACCOUNT_TYPE_CRYPTO', 'ready': True, 'hold': {'value': '0', 'currency': 'NEST'}, 'retail_portfolio_id': '<>'}, 'cursor': 'fd1a533a-a954-5b81-81d7-39042cb8a9f2'}, 
{'id': '<>', 'type': 'wallet', 'code': 'NEST', 'info': {'uuid': '<>', 'name': 'NEST Wallet', 'currency': 'NEST', 'available_balance': {'value': '0', 'currency': 'NEST'}, 'default': True, 'active': True, 'created_at': '2023-05-29T19:25:30.809Z', 'updated_at': '2023-05-29T19:25:30.809Z', 'deleted_at': None, 'type': 'ACCOUNT_TYPE_CRYPTO', 'ready': True, 'hold': {'value': '0', 'currency': 'NEST'}, 'retail_portfolio_id': '<>'}, 'cursor': '6aea58f4-39d2-57a5-b688-8e24248d2b2a'}, 
{'id': '<>', 'type': 'wallet', 'code': 'NEST', 'info': {'uuid': '<>', 'name': 'NEST Wallet', 'currency': 'NEST', 'available_balance': {'value': '0', 'currency': 'NEST'}, 'default': True, 'active': True, 'created_at': '2023-05-29T19:25:30.809Z', 'updated_at': '2023-05-29T19:25:30.809Z', 'deleted_at': None, 'type': 'ACCOUNT_TYPE_CRYPTO', 'ready': True, 'hold': {'value': '0', 'currency': 'NEST'}, 'retail_portfolio_id': '<>'}, 'cursor': '31f61e56-682d-5efb-b2a2-2fe30c2bf17c'}, 
{'id': '<>', 'type': 'wallet', 'code': 'NEST', 'info': {'uuid': '<>', 'name': 'NEST Wallet', 'currency': 'NEST', 'available_balance': {'value': '0', 'currency': 'NEST'}, 'default': True, 'active': True, 'created_at': '2023-05-29T19:25:30.809Z', 'updated_at': '2023-05-29T19:25:30.809Z', 'deleted_at': None, 'type': 'ACCOUNT_TYPE_CRYPTO', 'ready': True, 'hold': {'value': '0', 'currency': 'NEST'}, 'retail_portfolio_id': '<>'}, 'cursor': 'ef8a05ca-422b-54cf-99d9-bdc0f3893a58'}, 
{'id': '<>', 'type': 'wallet', 'code': 'NEST', 'info': {'uuid': '<>', 'name': 'NEST Wallet', 'currency': 'NEST', 'available_balance': {'value': '0', 'currency': 'NEST'}, 'default': True, 'active': True, 'created_at': '2023-05-29T19:25:30.809Z', 'updated_at': '2023-05-29T19:25:30.809Z', 'deleted_at': None, 'type': 'ACCOUNT_TYPE_CRYPTO', 'ready': True, 'hold': {'value': '0', 'currency': 'NEST'}, 'retail_portfolio_id': '<>'}, 'cursor': 'e59d52fc-6a9a-5021-a209-764887baa221'}, 
{'id': '<>', 'type': 'wallet', 'code': 'NEST', 'info': {'uuid': '<>', 'name': 'NEST Wallet', 'currency': 'NEST', 'available_balance': {'value': '0', 'currency': 'NEST'}, 'default': True, 'active': True, 'created_at': '2023-05-29T19:25:30.809Z', 'updated_at': '2023-05-29T19:25:30.809Z', 'deleted_at': None, 'type': 'ACCOUNT_TYPE_CRYPTO', 'ready': True, 'hold': {'value': '0', 'currency': 'NEST'}, 'retail_portfolio_id': '<>'}, 'cursor': '3e9b3e5d-4c6e-5188-b319-84ec747abae4'}, 

all look exactly the same (id, uuid, retail_portfolio_id stripped), with the same ids, only the curser is different every time

@joergkiesewetter
Copy link
Author

@carlosmiei any new insights here?

@joergkiesewetter
Copy link
Author

figured it out. Before you make calls for coinbase advanced, you should make a dedicated call to

client.load_accounts(params={
    'paginate': True,
})

In this way you can make sure, that the accounts are loaded paginated. If not, this will be done internally without pagination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants