Last active
August 29, 2015 14:12
-
-
Save fuzzysteve/909b6a868b168e070866 to your computer and use it in GitHub Desktop.
load system volume
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 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