Skip to content

Instantly share code, notes, and snippets.

@fuzzysteve
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fuzzysteve/909b6a868b168e070866 to your computer and use it in GitHub Desktop.
Save fuzzysteve/909b6a868b168e070866 to your computer and use it in GitHub Desktop.
load system volume
function loadSystemVolume(typeid,systemID,sellbuy,cachebuster){
if (typeof systemID == 'undefined'){
systemID=30000142;
}
if (typeof typeid == 'undefined'){
throw 'need typeids';
}
if (typeof cachebuster == 'undefined'){
cachebuster=1;
}
if (typeof sellbuy == 'undefined' || sellbuy==1){
sellbuy='sell_orders';
} else {
sellbuy='buy_orders';
}
var volume=0;
var url="http://api.eve-central.com/api/quicklook?cachebuster="+cachebuster+"&usesystem="+systemID+"&typeid=";
var parameters = {method : "get", payload : ""};
var xmlFeed = UrlFetchApp.fetch(url+typeid, parameters).getContentText();
var xml = XmlService.parse(xmlFeed);
if(xml) {
var rows=xml.getRootElement().getChild("quicklook").getChild(sellbuy).getChildren("order");
for(var i = 0; i < rows.length; i++) {
volume+=parseInt(rows[i].getChild('vol_remain').getValue());
}
}
return volume;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment