How to view KuCoin exchange prices in Google Sheets

in #crypto7 years ago

If you want to see the value of your KuCoin exchange coins in Google sheets, like this:

kucoin gs.PNG
then you just need a little code.

Step 1: Enter code editing mode in Google sheets

Step2: Enter the code

kucoin.PNG

Here it is for copy and pasting:

function Get_KuCoinPrice(market)
{
// example HST-BTC
var url = "https://api.kucoin.com/v1/open/tick?symbol="+market;
var response = UrlFetchApp.fetch(url);
var text = response.getContentText();
var myjson = JSON.parse(text);
var price = myjson.data.lastDealPrice;
return price;
}

Step 3: Call the code in your sheet

Capture.PNG

Step 4: Enjoy!

Some example Markets are:

  • DBC-BTC (for Deep Brain Chain)
  • KCS-BTC (for KuCoins themselves)
Sort:  

Thanks so much! I had been looking for that for a while! How would you get the Open Buy/Sell Orders in Google Sheets? Thanks in advance!

Hi matbest! i try it right now but it seems doesn't work!

function Get_KuCoinPrice(market)
{
var url = "https://api.kucoin.com/api/v1/prices?currencies="+market; // market è la cella
// var response = UrlFetchApp.fetch(url);
var response = UrlFetchApp.fetch(url);
Logger.log(response.getContentText());

var text = response.getContentText();
var myjson = JSON.parse(text);
var price = myjson.data.lastDealPrice;
return price;
}

i change it in this way.... can you help me?