Created
June 7, 2017 14:01
-
-
Save stw/dfb5f8206d197a04c24efbd60d5a3d3e to your computer and use it in GitHub Desktop.
Pull Bittrex field
This file contains 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 search(nameKey, myArray){ | |
for (var i=0; i < myArray.length; i++) { | |
if (myArray[i].MarketName === nameKey) { | |
return myArray[i]; | |
} | |
} | |
} | |
function pullBittrex(market) { | |
var response = UrlFetchApp.fetch("https://bittrex.com/api/v1.1/public/getmarketsummaries"); | |
var json = JSON.parse(response); | |
return search(market, json.result); | |
} | |
/** | |
* Pulls the bittrex field for the given market. | |
* | |
* @param {market, field} market. | |
* @return the field for the market. | |
* @customfunction | |
*/ | |
function updateBittrexField(market, field) { | |
return pullBittrex(market)[field]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment