Created
December 13, 2017 05:25
-
-
Save brlafreniere/1670cff49528cd5468e3701b5228bfec 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
function getCurrentPrice(currency) { | |
var response = UrlFetchApp.fetch("https://api.gdax.com/products/" + currency + "-USD/ticker"); | |
var response_json = JSON.parse(response); | |
return response_json.price; | |
} | |
function update_prices() { | |
SpreadsheetApp.getActiveSheet().getRange('B2').setValue(getCurrentPrice('BTC')); | |
SpreadsheetApp.getActiveSheet().getRange('B3').setValue(getCurrentPrice('LTC')); | |
SpreadsheetApp.getActiveSheet().getRange('B4').setValue(getCurrentPrice('ETH')); | |
} | |
function run () { | |
update_prices(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment