How to Compare 200+ Cryptocurrencies with Open-Source CoinScraper Module
By: Jacob Tadesse
Tags: Web Scraping, Python, Pandas, Cryptocurrency, Data Science

A bit dramatic, I know, but it’s a pretty big deal if you are an overbought/oversold kind-of-trader. Most traders use technical analysis to and their favorite indicators to make smart decisions in the market. This could range from moving averages or exponential moving average, depending on the trader. Some may prefer Moving Average Convergence Divergence (MACD) and others on-balance volume (OBV).

Everyone I know uses different tools and we all use some of the same tools as well, but this post is not about Bollinger Bands, Fibonacci Retracements, or Ichimoku Clouds. This post is about the coinscrapper, and while those tools are nice, you need the data before you can use any tool!

The coinscraper client was designed to compare the top 200 supported assets on Kucoin’s decentralized exchange. Each crypto asset’s historical and fundamental data is sourced from coinmarketcap.com. After all the data is collected, the data is preprocessed before calculating relative strength index. We end up with a summary table of the top 200 assets along with their relative strength.

The client has a few requirements/dependencies, please see requirements.txt file, or install the following:

import requests

import pandas as pd

import time

import random

import math

import numpy as np

from math import pi

import matplotlib.pyplot as plt

# %matplotlib inline

from os import mkdir

from os.path import exists

To install the client module, download the .py file and the demo notebook for Google Colab. You can download the files from the repo here.

Connecting to Client

Now that you have the client module installed, open the Demo notebook and run this cell. The demo will walk through some errors and show you how to fix them if they happen to you while running this client.

from coinscraper import coinscrapper

today = 'YYYYMMDD'

client = coinscrapper(today)

The client module will require a google authentication, and will also require a selenium web-driver. I would suggest running the client in Google Colab to test it out. If you are experiencing any errors, please make sure you have uploaded the files to your Colab Notebooks folder on Google Drive.

Feel free to change the file path or change any functionality.

Pulling Summary

The coinscraper client is filled with various methods, but the all purpose one is the .summary() method. This function was designed to process all the actions from getting the list of assets that are traded on KuCoin; creating links for historic data; converting html tables to dataframes; munging the data; generating a .csv file, and an html table with all the results.

client.summary()

Access Saved Datasets

Using the client we can also access the datasets saved during the summary process. The datasets are saved in a python list, and will contain historic data for each asset. The fundamental data and the RSI dataset are separte pythonic lists of datasets.

client.technical_data client.fundamental_data client.rsi_data

Below is an example of how to access the saved datasets using the client.In [10]:

# Historic Price Data

list_of_historic_data = client.technical_data

print('Historic Price Data: ')

display(list_of_historic_data[0].head()) # Fundamental Data

list_of_fundamental_data = client.fundamental_data

print('

Fundamental Data:

')

display(list_of_fundamental_data[0].set_index(0).stack()) # RSI Data

list_of_RSI_data = client.rsi_data

print('

RSI Data: ')

display(list_of_RSI_data[0].tail()) Historic Price Data: DateOpen*HighLowClose**VolumeMarket Cap0Aug 20, 202091.25101.3191.25101.3115344164317903490141Aug 19, 202093.4794.4989.5591.2810936760116129313732Aug 18, 202093.3797.1592.0993.5211999836316524633993Aug 17, 202091.2294.6589.7993.368319201116495215074Aug 16, 202090.0791.3288.4191.22641774871611628957 Fundamental Data: Monero Price 1 $93.81 USD

Monero ROI 1 3,693.27%

Market Rank 1 #16

Market Cap 1 $1,657,837,591 USD

24 Hour Volume 1 $176,797,734 USD

Circulating Supply 1 17,672,780 XMR

Total Supply 1 17,672,780 XMR

Max Supply 1 No Data

All Time High 1 $495.84 USD(Jan 07, 2018)

All Time Low 1 $0.212967 USD(Jan 14, 2015)

52 Week High / Low 1 $105.52 USD /$26.70 USD

90 Day High / Low 1 $105.52 USD /$60.43 USD

30 Day High / Low 1 $105.52 USD /$70.89 USD

7 Day High / Low 1 $105.52 USD /$88.41 USD

24 Hour High / Low 1 $105.52 USD /$92.60 USD

Yesterday's High / Low 1 $101.31 USD /$91.25 USD

Yesterday's Open / Close 1 $91.25 USD /$101.31 USD

Yesterday's Change 1 $10.06 USD (11.02%)

Yesterday's Volume 1 $153,441,643 USD

dtype: object RSI Data: DateOpen*HighLowClose**VolumeMarket Capdate_RSIdate_ 2020–08–16Aug 16, 202090.0791.3288.4191.226417748716116289572020–08–1659.6750132020–08–17Aug 17, 202091.2294.6589.7993.368319201116495215072020–08–1762.4408222020–08–18Aug 18, 202093.3797.1592.0993.5211999836316524633992020–08–1862.6471052020–08–19Aug 19, 202093.4794.4989.5591.2810936760116129313732020–08–1957.8562802020–08–20Aug 20, 202091.25101.3191.25101.3115344164317903490142020–08–2069.210352

Access RSI Charts

Using the client we can access the RSI Charts saved during the summary process. The charts are saved in a python list, and also saved to your authenticated google drive. The plots are the matplotlib objects that just require the .show() method.

client.plots client.candle_sticks (coming soon)

Below is an example of how to access the saved datasets using the client.In [24]:

import os

In [29]:

os.listdir('drive/My Drive/CoinScraper/charts/monero/')

Out[29]:

['RSI-20200820.png']

In [37]:

img = plt.imread("/content/drive/My Drive/CoinScraper/charts/monero/RSI-20200820.png")

plt.figure(figsize=(32,18))

plt.axis('off')

plt.imshow(img);

Access the Log File

Using the client we can also access the log file saved during the summary process. The log file is a text file that shows which processes are running, or errors that occur.

client.log (Below is an example of how to access the log.)

[48] client.log

Here is the table html code generated for web: