title: How to Extract All Crypto Symbols from Coinmarketcap
body: <p>I am using the following code to extract some data from Coinmarketcap by inserting the symbols of the coins one by one, but since there are new cryptos added to the list everyday, I need to extract all the cryptos at once from <a href="https://coinmarketcap.com/coins/views/all/" rel="nofollow noreferrer">https://coinmarketcap.com/coins/views/all/</a> in order to have the updated list every day. How could I modify the following code so that I have all the crypto symbols in a text file first and then do the rest? Your help is highly appreciated.</p>
  <pre><code>import time
  import requests
  
  
  a = []
  
  
  while True:
            try: 
               x = input(&quot;Type the symbols of The currencies. Write 'done' when you are done: &quot;)
               open('/Users/DearUser/crypto_symbol_3.txt', 'a').close()
               if x.upper() == &quot;DONE&quot;:
                  break
  
               def get_timestamp(datetime: str):
                   return int(time.mktime(time.strptime(datetime, '%Y-%m-%d')))
  
  
               def get_btc_quotes(start_date: str, end_date: str):
                   start = get_timestamp(start_date)
                   end = get_timestamp(end_date)
                   url = f'https://web-api.coinmarketcap.com/v1/cryptocurrency/ohlcv/historical?symbol={x}&amp;convert=USD&amp;time_start={start}&amp;time_end={end}'
                   return requests.get(url).json() 
  
  
  
               data = get_btc_quotes(start_date='2021-11-09',
                                       end_date='2021-11-11')
  
  
  
  
               import pandas as pd
               data_flat = [quote['quote']['USD'] for quote in data['data']['quotes']]
               df = pd.DataFrame(data_flat)
               c = df.iat[1,5]
               if c==0:
                  print(&quot;The marketcap of your entry is zero. Please try another one...&quot;)
               if x not in open('/Users/DearUser/crypto_symbol_3.txt', 'r').read() and c!=0:
                  open('/Users/DearUser/crypto_symbol_3.txt', 'a').write(f'\&quot;{x}\&quot;: {c},\n')
               elif x in open('/Users/DearUser/crypto_symbol_3.txt', 'r').read():
                    print(&quot;Your entry already exists! Please try again...&quot;)      
            except:
                  print(&quot;Your input is not valid! Please try again...&quot;)
  s = open('/Users/DearUser/crypto_symbol_3.txt', 'r').read()
  print(s)
  </code></pre>