Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. https://moneropric.es/fiat.json
  2.  
  3. // Bitcoincharts.com - Weighted Prices
  4.  
  5. var url = "http://api.bitcoincharts.com/v1/weighted_prices.json";
  6. var response = UrlFetchApp.fetch(url);
  7. var json = response.getContentText();
  8. var bcharts_data = JSON.parse(json);
  9.  
  10. function bit24hr(inNum){
  11. var x = bcharts_data["USD"]["24h"];
  12. if (typeof inNum != "number") { // check to make sure input is a number
  13. throw "input must be a number"; // throw an exception with the error message
  14. }
  15. var y = inNum * x
  16. return y;
  17. }
  18.  
  19. // Monero Price in USD
  20.  
  21. var url = "https://moneropric.es/fiat.json";
  22. var response = UrlFetchApp.fetch(url);
  23. var json = response.getContentText();
  24. var monero_data = JSON.parse(json);
  25.  
  26. function monero(inNum){
  27. var x = monero_data["US Dollar"]["fiat-rate"];
  28. if (typeof inNum != "number") { // check to make sure input is a number
  29. throw "input must be a number"; // throw an exception with the error message
  30. }
  31. var y = inNum * x
  32. return y;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement