Geek Logbook

Tech sea log book

Scraping Whale Alerts

Following the questions about Whale-Alert first post. The whale alert page provides interesting information about whales, in the cryptocurrency argot it’s a transaction above certain amount of money. These are the transactions which are above a certain level of price. You can see this information on their webpage https://whale-alert.io/

However, I wonder how many bitcoins, or whatever crypto, it’s a whale. Having a big 

fluctuation in their price makes this idea an interesting comparison between the appreciation or not of the Money.

For that reason, I’m working in a simple web scrapper that takes the information from the Whale Alert page and saves it. Does whale alert change how they see a whale? remains its always the same price?

The code snippet is quite simple. You can find it in my Utilities Repository

import requests
from bs4 import BeautifulSoup
import pandas as pd
from datetime import datetime

URL = "https://whale-alert.io/whales"
page = requests.get(URL)
soup = BeautifulSoup(page.content, "html.parser")
table = soup.find('table', attrs={'class': 'table'})
table_body = table.find('tbody')
table_rows = table_body.find_all('tr')
crypto_dict = {"datetime_utc": [], "crypto": [], "known": [], "unknown": []}
current_utc = datetime.utcnow()

if __name__ == "__main__":
    for x in table_rows:
        coin = x.find("i").get_text().strip()
        td_list = x.find_all("td")
        known = td_list[1].text
        unknown = td_list[2].text
        crypto_dict["datetime_utc"].append(current_utc)
        crypto_dict["crypto"].append(coin)
        crypto_dict["known"].append(known)
        crypto_dict["unknown"].append(unknown)
    whale_df = pd.DataFrame.from_dict(crypto_dict)
    print(whale_df)

If you run it you’ll obtain the following output

Leave a Reply

Your email address will not be published. Required fields are marked *.