Comments (8)
Here's another example of what's showing up and now showing up:
from list.
Hi, and welcome.
Yes I saw that last time. Coinmarketcap change the api 2 or 3 month ago.
It's seems free api from coinmarketcap gave only the 100 first coins
We need to rewrite this coinmarketcap.js and use an API key now.
Need to log on https://coinmarketcap.com/api/ create an account and choose basic account.
I have no time at the moment to do this. May be one day... so need help
from list.
just a patch if you need
put your API key after 'X-CMC_PRO_API_KEY': '<<<>>>'
replace API_coinmarketcap.gs
by this
function getCoinData() {
var options = {
"muteHttpExceptions": true,
"headers" : {
'X-CMC_PRO_API_KEY': '<<<<your api key here>>>>'
},
}
var url = "https://pro-api.coinmarketcap.com/v1/cryptocurrency";
var endpoint = "/listings/latest"; // endpoint
var param = "?start=1&limit=500&cryptocurrency_type=tokens&convert=EUR"
try {
var response = UrlFetchApp.fetch(url + endpoint + param, options);
} catch(e) {
Logger.log("message:" + e.message + "\nfileName:" + e.fileName + "\nlineNumber:" + e.lineNumber + "\nstack:" + e.stack);
return false;
}
Logger.log(response)
var results = JSON.parse(response.getContentText());
Logger.log(results)
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Sheet1");
return setCryptocurrencyData(sheet, results);
}
function setCryptocurrencyData(sheet, results) {
var num = results['data'].length;
var coins = [];
coins.push(['シンボル', '価格(BTC)', '24時間の出来高']);
for (var i = 0; i < results['data'].length; i++) {
var symbol = results['data'][i]["symbol"];
//var price = results['data'][i]["quote"]["BTC"]["price"];
//var volume_24h = results['data'][i]["quote"]["BTC"]["volume_24h"];
coins.push([symbol]);
}
var range = sheet.getRange(1, 1, results['data'].length + 1, coins[0].length);
//range.setValues(coins);
}
from list.
Thanks. I see what you're doing with the patch, but I'm not sure what you mean by
replace API_coinmarketcap.gs
by this
I don't have that .gs
file in my scripts. And I don't see that function in the code. What am I missing?
from list.
sorry, I mixed up some project
just replace the function coinmarketcap() in main.gs by this
Don't forget to replace the api key in the function
function coinmarketcap() {
var options = {"muteHttpExceptions": true,
"headers" : {'X-CMC_PRO_API_KEY': '<<<<your api key here>>>>'}
}
var url = "https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest";
var param = "?&limit=500&convert=EUR"
try {
var response = UrlFetchApp.fetch(url + param, options);
} catch(e) {
Logger.log("message:" + e.message + "\nfileName:" + e.fileName + "\nlineNumber:" + e.lineNumber + "\nstack:" + e.stack);
return false;
}
//original
//{price_usd=3868.11723075, symbol=BTC, last_updated=1546194083, 24h_volume_eur=4305415992.52, total_supply=17453237.0, 24h_volume_usd=4924724753.95, market_cap_eur=59021299995.0, price_btc=1.0, available_supply=17453237.0, market_cap_usd=67511166772.0, percent_change_1h=0.06, percent_change_24h=-0.58, name=Bitcoin, max_supply=21000000.0, rank=1, id=bitcoin, percent_change_7d=-3.66, price_eur=3381.6821484}
//{data=[{symbol=BTC, circulating_supply=17453225, last_updated=2018-12-30T18:08:22.000Z, total_supply=17453225, cmc_rank=1, platform=null, tags=[mineable], date_added=2013-04-28T00:00:00.000Z, quote={EUR={percent_change_1h=0.2303, last_updated=2018-12-30T18:09:00.000Z, percent_change_24h=-0.4681, market_cap=5.9089233308678444E10, price=3385.5767807198067, volume_24h=4.304593294505483E9, percent_change_7d=-3.7054}}, num_market_pairs=6722, name=Bitcoin, max_supply=21000000, id=1, slug=bitcoin}, {symbol=XRP, circulating_supply=4.0794121066E10, last_updated=2018-12-30T18:09:02.000Z, total_supply=9.9991738974E10, cmc_rank=2, platform=null, tags=[], date_added=2013-08-04T00:00:00.000Z, quote={EUR={percent_change_1h=0.0143,
var text = response.getContentText();
var data = JSON.parse(text);
Logger.log(data)
var array = [];
for(var x in data.data){
array.push({'symbol': data.data[x].symbol,
'rank': data.data[x].cmc_rank,
'name': data.data[x].name,
'percent_change_1h': data.data[x].quote.EUR.percent_change_1h,
'percent_change_24h': data.data[x].quote.EUR.percent_change_24h,
'percent_change_7d': data.data[x].quote.EUR.percent_change_7d,
'price_eur': data.data[x].quote.EUR.price})
}
Logger.log(array)
return array;
}
from list.
That's a step in the right direction, but lots of #NUM!
errors in the Market sheet now.
from list.
On my side it works like you on this point.
The missing information are not useful.
I need to work on it but as I said I have no time for the moment to clean the code.
from list.
The same issue here. Getting all the coins but with this #NUM! value
from list.
Related Issues (20)
- USD balance and bitfinex/Kraken HOT 1
- Request Bitmex HOT 2
- HitBTC request HOT 2
- Binance error -1022 HOT 2
- Kucoin API update HOT 4
- function coinmarketcap() Error 429 "Too many requests" HOT 3
- Missing File | Page 404 HOT 2
- ReferenceError: jsSHA is not defined HOT 1
- Error 403 binance API HOT 6
- Coinmarketcap API change of endpoint URI + API Key HOT 2
- NUM! everywhere. [HELP] HOT 1
- BITFINEX "apikey: invalid"
- The number of rows in the range must be at least 1
- coinMarketCap api error HOT 4
- Binance Error 401 - fapi request HOT 2
- https://api.binance.com returned code 400. "msg":"Signature for this request is not valid."
- Kucoin API request fail (code 401) HOT 3
- Google Sheets no longer has Tools / Script editor function
- API Bitvavo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from list.