Scrapping New Cryptocurrencies Using Python

Future
4 min readJan 30, 2023

--

Photo by Kanchanara on Unsplash

Cryptocurrencies have been a hot topic in the financial world for the past few years, with Bitcoin being the most well-known and widely used. While the market for cryptocurrencies can be volatile, it also offers a number of opportunities for traders, investors, and researchers. In order to take advantage of these opportunities, one needs access to real-time data on the cryptocurrency markets. This data can be obtained through APIs provided by various exchanges, but if you need to track prices of multiple cryptocurrencies or exchanges, it can be a lot of work to collect this data yourself.

A python web scrapper can be a solution to this problem. A web scrapper is a program that automatically retrieves data from websites. In this case, we can use a web scrapper to automatically collect data on cryptocurrency prices from websites such as CoinGecko, CoinMarketCap, Binance, and Coinbase.

The first step in creating a cryptocurrency web scrapper is to choose the data you want to collect. This can include the price of a cryptocurrency in a specific fiat currency, the 24-hour trading volume, and the market capitalization. Once you have decided on the data you want to collect, you need to identify which websites provide this information and how you can access it.

Next, you will need to write the code for the scrapper. A popular library for web scraping in Python is BeautifulSoup, which makes it easy to extract data from websites using HTML and CSS. You can use this library to retrieve the relevant data from each website, parse it, and store it in a data structure such as a Pandas DataFrame or a SQL database.

In this example, we will scrap for newly created cryptocurrencies that are detected and added in CoinGecko. This allows users to be updated on the latest cryptocurrencies that are created and possibly invest in them.

To further improve the following code, you can send a notification to when the web scrapper detects a new token/cryptocurrency. You may also include this into your trading strategy!

from urllib.request import Request, urlopen
from bs4 import BeautifulSoup as soup
url = "https://www.coingecko.com/en/new-cryptocurrencies"
req = Request(url , headers={'User-Agent': 'Mozilla/5.0'})

webpage = urlopen(req).read()
page_info = soup(webpage, "html.parser")
new_cryptos = page_info.findAll("span", class_="d-lg-inline font-normal text-3xs tw-ml-0 md:tw-ml-2 md:tw-self-center tw-text-gray-500 dark:tw-text-white dark:tw-text-opacity-60")
crypto = []
for new_crypto in new_cryptos:
crypto.append(new_crypto.get_text().replace("\n", ""))

print(crypto)
#Printed Response
['XRPC', 'BELIEVE', 'TOAD', '$CRYPT', 'THE', 'VB', 'HACHI', 'XRT', 'SILV2', 'CLB', 'BYTES', 'MU', 'LSETH', 'USPC', 'STATS', 'TUPAN', 'GEM', 'GOBLIN', 'SHIL', 'EPILLO', 'DOGPAD', 'I-STABLE', 'PTF', 'FLONA', 'HSE', 'DUX', 'TICKR', 'GMMT', 'BC', 'OKAGE', 'GFLY', 'PDF', 'SFP', 'MORE', 'FOMO', 'RAVE', 'HADES', 'HOPERS', 'METADOGE', 'BOO', 'NEU', 'ARBINU', 'DEO', 'SHARKS', '$LOBSTER', 'NOX', 'MTAO', 'VNO', 'VETME', 'HAMI', 'INTL', 'BOO', 'BOXA', 'ANB', 'GWINK', 'WSGB', 'QUON', 'PINA', 'AREA', 'SIMP', 'H', 'NFAI', 'BAY', 'FLU', 'TWT', 'OKANA', 'MEF', 'DSETH', 'TRG', 'MEME', 'ETHER', 'M', 'KKMA', 'POG', 'GVC', 'DOGGO', 'VELA', 'VTR', ' DTG', 'WIX', 'TEXAN', 'TOMI', 'NEXA', 'ARENA', 'AGN ', 'LOCAL', 'ETW', 'COM', 'MINT', 'IAZUKI', 'HIMFERS', 'TIPO', 'COPE', 'SHDB', 'SWDB', 'LIT', 'LIUX', 'HIFI', 'KDOE', 'PROX']

Once you have collected the data, you can use it for various purposes. For example, you can create a dashboard to track the prices of multiple cryptocurrencies in real-time. You can also use the data to perform analysis and make predictions on the future of the cryptocurrency market. For example, you can use machine learning algorithms to identify patterns in the data and make predictions on future price movements.

It is important to keep in mind that web scraping is subject to legal and ethical considerations. Some websites explicitly prohibit web scraping, while others may limit the amount of data that can be retrieved. To avoid breaking any rules, it is a good idea to check the terms of use for each website before you start scraping.

In conclusion, a cryptocurrency web scrapper can be a powerful tool for those interested in the cryptocurrency market. It provides access to real-time data that can be used for analysis and decision-making. While web scraping can be subject to legal and ethical considerations, it can be done responsibly by following the terms of use for each website. If you are interested in creating a cryptocurrency web scrapper, you can start by deciding on the data you want to collect, identifying the websites that provide this data, and writing the code using a library such as BeautifulSoup.

Disclaimer: This article is purely for reference and education. Do not use this as investment advice. Backtest the strategy with your desired financial instrument before executing with live account.

--

--

Future
Future

Written by Future

Looking towards the Future

No responses yet