8

I've been trying to figure out a way to get a list of all the Coins that Coinbase has listed (not necessarily for trade) but can't figure it out, in the early days it was easy as you could just login and see the list of 4 basic coins that were supported (and could hard code those values in a program and/or script).

But now they have a list of many coins listed, some as I understand, which are not available to actually trade but are listed for educational purposes (as stated on their site when looking at such coins).

I was wondering if anyone has figured out a way to get a list those coins (all supported and simply listed) perhaps with a tag of which are actually supported for trade.

I looked at the API and the REST API (using a simple GET request over HTTPS or using cURL for testing) has the following endpoints:

curl https://api.coinbase.com/v2/currencies - This lists all the Fiat currencies.

and:

curl https://api.pro.coinbase.com/products - This lists all the supported trading pairs (which is not what I'm looking for....)

Any ideas, short of logging in and parsing the html? (which could break since the site can be reformatted etc at any time).

Any help would be greatly appreciated!

Chucky
  • 398
  • 3
  • 15

4 Answers4

8

perhaps not really what you asked, but you could also use https://api.pro.coinbase.com/currencies

import requests
import json

uri = 'https://api.pro.coinbase.com/currencies'
response = requests.get(uri).json()

for i in range(len(response)):
    if response[i]['details']['type'] == 'crypto':
        print(response[i]['id])

This will return the coins available for trading.

NemoMeMeliorEst
  • 513
  • 4
  • 10
4

I'm not sure if I this is the response that you want or not. I first used the first URL that you have listed... The response from that looked like it didn't have the available coins. I then tried the below URL instead and the response does have a lot of curriencies listed on it. You can parse it by loading with JSON and looking for the fields that you want.

Also I didn't see a language posted with your question. I'm using python3 below. If you're a Linux person you can also just use curl GET from the command line. It doesn't matter the language... you just need to make a GET request to that URL and parse the response however you see fit.

To get 1 particular field you can use a line like response['data']['rates']['BTC'] to extract '0.00029200' out of the response/JSON string.

>>> r = requests.get("https://api.coinbase.com/v2/exchange-rates")
>>> response = json.loads(r.text)
>>> pprint.pprint(response)
{'data': {'currency': 'USD',
          'rates': {'AED': '3.67',
                    'AFN': '75.22',
                    'ALL': '108.84',
                    'AMD': '487.59',
                    'ANG': '1.79',
                    'AOA': '311.37',
                    'ARS': '37.32',
                    'AUD': '1.38',
                    'AWG': '1.80',
                    'AZN': '1.70',
                    'BAM': '1.71',
                    'BAT': '9.00418244',
                    'BBD': '2.00',
                    'BCH': '0.00879160',
                    'BDT': '83.80',
                    'BGN': '1.71',
                    'BHD': '0.377',
                    'BIF': '1824',
                    'BMD': '1.00',
                    'BND': '1.58',
                    'BOB': '6.90',
                    'BRL': '3.65',
                    'BSD': '1.00',
                    'BTC': '0.00029200',
                    'BTN': '71.11',
                    'BWP': '10.41',
                    'BYN': '2.15',
                    'BYR': '21495',
                    'BZD': '2.02',
                    'CAD': '1.31',
                    'CDF': '1631.00',
                    'CHF': '0.99',
                    'CLF': '0.0242',
                    'CLP': '656',
                    'CNH': '6.71',
                    'CNY': '6.70',
                    'COP': '3174.95',
                    'CRC': '608.98',
                    'CUC': '1.00',
                    'CVE': '96.90',
                    'CZK': '22.50',
                    'DJF': '178',
                    'DKK': '6.52',
                    'DOP': '50.44',
                    'DZD': '118.30',
                    'EEK': '14.61',
                    'EGP': '17.68',
                    'ERN': '15.00',
                    'ETB': '28.52',
                    'ETC': '0.25542784',
                    'ETH': '0.00944599',
                    'EUR': '0.87',
                    'FJD': '2.10',
                    'FKP': '0.76',
                    'GBP': '0.76',
                    'GEL': '2.66',
                    'GGP': '0.76',
                    'GHS': '4.98',
                    'GIP': '0.76',
                    'GMD': '49.52',
                    'GNF': '9210',
                    'GTQ': '7.74',
                    'GYD': '208.55',
                    'HKD': '7.85',
                    'HNL': '24.49',
                    'HRK': '6.49',
                    'HTG': '78.37',
                    'HUF': '276',
                    'IDR': '13940.00',
                    'ILS': '3.63',
                    'IMP': '0.76',
                    'INR': '70.93',
                    'IQD': '1190.000',
                    'ISK': '120',
                    'JEP': '0.76',
                    'JMD': '132.72',
                    'JOD': '0.710',
                    'JPY': '109',
                    'KES': '100.60',
                    'KGS': '68.70',
                    'KHR': '4015.00',
                    'KMF': '429',
                    'KRW': '1114',
                    'KWD': '0.303',
                    'KYD': '0.83',
                    'KZT': '380.63',
                    'LAK': '8559.50',
                    'LBP': '1511.15',
                    'LKR': '178.40',
                    'LRD': '160.75',
                    'LSL': '13.53',
                    'LTC': '0.03208728',
                    'LTL': '3.22',
                    'LVL': '0.66',
                    'LYD': '1.385',
                    'MAD': '9.53',
                    'MDL': '17.05',
                    'MGA': '3465.0',
                    'MKD': '53.78',
                    'MMK': '1519.04',
                    'MNT': '2453.75',
                    'MOP': '8.08',
                    'MRO': '357.0',
                    'MTL': '0.68',
                    'MUR': '34.23',
                    'MVR': '15.49',
                    'MWK': '728.47',
                    'MXN': '19.14',
                    'MYR': '4.10',
                    'MZN': '61.87',
                    'NAD': '13.53',
                    'NGN': '361.50',
                    'NIO': '32.60',
                    'NOK': '8.43',
                    'NPR': '113.78',
                    'NZD': '1.45',
                    'OMR': '0.385',
                    'PAB': '1.00',
                    'PEN': '3.33',
                    'PGK': '3.36',
                    'PHP': '52.13',
                    'PKR': '139.30',
                    'PLN': '3.73',
                    'PYG': '6084',
                    'QAR': '3.64',
                    'RON': '4.14',
                    'RSD': '103.53',
                    'RUB': '65.47',
                    'RWF': '886',
                    'SAR': '3.75',
                    'SBD': '8.06',
                    'SCR': '13.67',
                    'SEK': '9.05',
                    'SGD': '1.35',
                    'SHP': '0.76',
                    'SLL': '8390.00',
                    'SOS': '582.00',
                    'SRD': '7.46',
                    'SSP': '130.26',
                    'STD': '21050.60',
                    'SVC': '8.75',
                    'SZL': '13.52',
                    'THB': '31.23',
                    'TJS': '9.43',
                    'TMT': '3.50',
                    'TND': '2.968',
                    'TOP': '2.26',
                    'TRY': '5.18',
                    'TTD': '6.77',
                    'TWD': '30.72',
                    'TZS': '2317.00',
                    'UAH': '27.70',
                    'UGX': '3670',
                    'USD': '1.00',
                    'USDC': '1.000000',
                    'UYU': '32.58',
                    'UZS': '8380.00',
                    'VEF': '248487.64',
                    'VND': '23287',
                    'VUV': '111',
                    'WST': '2.60',
                    'XAF': '573',
                    'XAG': '0',
                    'XAU': '0',
                    'XCD': '2.70',
                    'XDR': '1',
                    'XOF': '573',
                    'XPD': '0',
                    'XPF': '104',
                    'XPT': '0',
                    'YER': '250.30',
                    'ZAR': '13.27',
                    'ZEC': '0.02056344',
                    'ZMK': '5253.08',
                    'ZMW': '11.94',
                    'ZRX': '4.04721481',
                    'ZWL': '322.36'}}}
  • Oh that's a good point on the language! I apologize that I didn't put that in the OP, I'll update it to show that. I'm just using simple GET requests over HTTPS. I forgot about the exchange-rates endpoint but it's not quite what I'm looking for, I'd like to try and get a list of _just_ the crypto coins that are available as a listing (not necessarily supported for trading). Ultimately that may not be currently possible and may be a request for an API update to Coinbase itself... – Chucky Jan 31 '19 at 20:42
  • I think I'm going to accept this as the answer as it does list the all the coins. Ultimately the solution is to load all the currencies (fiat currencies) and then doing a diff with the exchange rates to get the coin list. As it stands now there's no way to be sure which coins are officially supported. This will do for now though. Thanks! – Chucky Jan 31 '19 at 21:50
  • Okay... the data may be there somewhere... it's worth looking around at the different API endpoints/URLs that are listed on there dev site –  Feb 01 '19 at 01:54
  • if you just want the crypto coins, why dont you extract only the 'keys' from the rates dictionary provided above? EDIT : Never mind, its not what you want..;) – NemoMeMeliorEst Feb 01 '19 at 09:48
2

The following code:

import requests
    
uri = 'https://api.pro.coinbase.com/currencies'
response = requests.get(uri).json()

for i in range(len(response)):
    if response[i]['details']['type'] == 'crypto':
        print(response[i]['id'])

Will provide this output:

COTI
BTC
ETH
LTC
BCH
ZEC
XTZ
XRP
XLM
EOS
ALGO
DASH
ATOM
CGLD
FIL
ADA
ICP
SOL
DOT
DOGE
OXT
KNC
MIR
REP
COMP
NMR
ACH
BAND
ZRX
BAT
LOOM
UNI
YFI
LRC
CVC
DNT
MANA
GNT
REN
LINK
BAL
ETC
USDC
RLC
DAI
WBTC
NU
AAVE
SNX
BNT
GRT
SUSHI
MLN
ANKR
CRV
STORJ
SKL
AMP
1INCH
ENJ
NKN
OGN
FORTH
GTC
TRB
CTSI
MKR
UMA
USDT
CHZ
SHIB
BOND
LPT
QNT
KEEP
CLV
MASK
MATIC
OMG
POLY
FARM
FET
PAX
RLY
PLA
RAI
IOTX
ORN
AXS
QUICK
TRIBE
UST
REQ
TRU
WLUNA
Flair
  • 2,609
  • 1
  • 29
  • 41
user381043
  • 21
  • 1