MMM-cryptocurrency
MMM-cryptocurrency copied to clipboard
Set sparklineIds for top 1000 coins at 2020-06-08
Top 1000 coin ready to use ;)
If you want to update list, use Postman to get JSON response from API, or use this PHP code :
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?start=1&limit=1000&convert=USD",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"X-CMC_PRO_API_KEY: `<YOUR_API_KEY>"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
AND create snippet with something like that :
<?php
$file = 'CMC-1000.json';
$content = file_get_contents ($file);
$content = json_decode($content);
$fp = fopen('coin-list.js', 'w');
fwrite($fp, "\t".'this.sparklineIds = {'."\r\n");
foreach($content->data as $coin){
fwrite($fp, "\t\t".'\''.$coin->slug.'\': '.$coin->id.','."\r\n");
}
fwrite($fp, "\t".'};');
fclose($fp);
I missed the notification of this PR. Sorry! If you want, just update it in order to remove conflicts and I'll merge! Sorry for the delay!
After some difficulties ... It's ok ! @matteodanelli