Added the getStockSymbols method to the TIX API, wich returns an array of the tradable symbols

This commit is contained in:
Santiago Kent 2018-09-29 17:19:24 -03:00 committed by danielyxie
parent 8f4ac830ad
commit dea7bd79c8
3 changed files with 16 additions and 1 deletions

@ -24,6 +24,14 @@ getStockPrice
getStockPrice("FISG"); getStockPrice("FISG");
getStockSymbols
-------------
.. js:function:: getStockSymbols()
Returns an array of the symbols of the tradable stocks.
getStockPosition getStockPosition
---------------- ----------------

@ -92,7 +92,7 @@ let NetscriptFunctions =
"installAugmentations|" + "installAugmentations|" +
// TIX API // TIX API
"getStockPrice|getStockPosition|buyStock|sellStock|shortStock|sellShort|" + "getStockPrice|getStockPosition|getStockSymbols|buyStock|sellStock|shortStock|sellShort|" +
"placeOrder|cancelOrder|" + "placeOrder|cancelOrder|" +
// Hacknet Node API // Hacknet Node API

@ -1668,6 +1668,13 @@ function NetscriptFunctions(workerScript) {
stock.b ? forecast += stock.otlkMag : forecast -= stock.otlkMag; stock.b ? forecast += stock.otlkMag : forecast -= stock.otlkMag;
return forecast / 100; //Convert from percentage to decimal return forecast / 100; //Convert from percentage to decimal
}, },
getStockSymbols : function(){
if (workerScript.checkingRam) {
return updateStaticRam("getStockSymbols", CONSTANTS.ScriptGetStockRamCost);
}
updateDynamicRam("getStockSymbols", CONSTANTS.ScriptGetStockRamCost);
return Object.values(StockSymbols);
},
getPurchasedServerLimit : function() { getPurchasedServerLimit : function() {
if (workerScript.checkingRam) { if (workerScript.checkingRam) {
return updateStaticRam("getPurchasedServerLimit", CONSTANTS.ScriptGetPurchasedServerLimit); return updateStaticRam("getPurchasedServerLimit", CONSTANTS.ScriptGetPurchasedServerLimit);