In this post we will be creating a Python script that will retrieve a list of all the supported cryptocurrencies available via the free Coin Gecko API. To do this we will be using the Python ‘Requests’ library which makes it super easy to send HTTP requests.
See the sample of Python code below where we utilize the Coin Gecko API to query the list of coins and return all supported cryptocurrencies back to output.
import requests
def get_supported_cryptos():
url = 'https://api.coingecko.com/api/v3/coins/list'
response = requests.get(url)
data = response.json()
return data
supported_cryptos = get_supported_cryptos()
print(f'The current list of supported cryptocurrencies is:')
for crypto in supported_cryptos:
print(f'{crypto["name"]} ({crypto["symbol"]})')
The above would return the following as output. Note that the below is just a sample of the data.
BitShares (bts)
Bitshark (btshk)
BitShiba (shiba)
Bitsliced (sliced)
BitSong (btsg)
Bitsonic (bsc)
Bitspawn (spwn)
BitStake (xbs)
Bitsten [OLD] (bst)
Bit Store (store)
Bitsubishi (bitsu)
Matka (mat)
Bitswift (bits)
Bittensor (tao)
BITTO (bitto)
BITT (bitt)
BitTokens (bxt)
>>>
Take a look at some of our other content around the Python programming language by clicking here.