Created
August 7, 2017 00:30
-
-
Save danielwatson6/283c18f526d0163c38f939b2aaf36a60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copy paste this into the JS console of any window that has loaded | |
// https://coinmarketcap.com/ | |
var CURRENCY = 'bitcoin'; | |
var w = window.open('https://coinmarketcap.com/currencies/' + CURRENCY + '/historical-data/?start=20000101&end=20170806'); | |
w.addEventListener('load', function () { | |
var rows = $(w.document.getElementById('historical-data')).find('tr'); | |
var data = []; | |
for (var i = 1; i < rows.length; i++) { | |
var items = $.map($(rows[i]).find('td'), function (td) { | |
return td.innerText; | |
}); | |
data.push({ | |
date: (new Date(items[0])).getTime(), | |
open: items[1], | |
high: items[2], | |
low: items[3], | |
close: items[4] | |
}); | |
} | |
w.document.write(JSON.stringify(data)) | |
}, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment