Welcome cryptocurrency

19th January, 2018 - 2 min. read - in Tutorials - Go to Index

Hey, before scrolling, I've made a tool to help people building presentations the modern way.
If you don't mind, I'd like to ask some feedback about it. Here the starting point to learn more.
Much appreciated!

Everybody talks about cryptocurrencies these days.

I’d like to explore the topic using a data-exploration approach.

The first thing to do is to find some dataset about the existing currencies out there. I’ve found CoinMarketCap.com as a good source but, unfortunately, no open data source there, except a couple of JSON files used for some website search functions.

So, again, time for a good scraping activity, which is always fun.

jQuery is already included in the website, thus, here the snippet that might be used to dump all the crypto currencies listed on the full list page. Just open the javascript console and paste this code:

var db = []
$('[role="row"]').each((i, e) => {
  var el = $(e)
  var ob = {}
  ob.id = el.attr('id')
  ob.name = el.find('.currency-name-container').text()
  ob.sym = el.find('.col-symbol').text()
  ob.cap = el.find('.market-cap').text()
  ob.price = el.find('.price').text()
  ob.circ = el.find('.circulating-supply').text().trim()
  ob.vol = el.find('.volume').text()
  ob.h = el.find('.percent-1h').text()
  ob.d = el.find('.percent-24h').text()
  ob.w = el.find('.percent-7d').text()

Of course, this snippet will work until the HTML markup won’t be rearranged.

A better approach might be using Runkit to expose that snippet as an API-call in order to get the latest state of the list anytime you need it.

Next time.

Spotted a typo or (likely) a grammar error? Send a pull request.