Einfaches Skript für BN8.1 Fortgeschrittenes Skript für BN8.2-3 & BN8+ Achievement in Bitburner.
BN8.1
Funktion runden(Wert) { let Zeichen = ["", "k", "m", "b", "t"] let which = 0 while (value > 999 || value < -999) { value = Math. round(value / 10) / 100 ++what } Rückgabewert + Zeichen[was] } /** @param {NS} ns */ export async function main(ns) { ns.disableLog("ALL") let index = ns.args[0] // sollte FSIG oder FLCM sein let history = [] let max_shares = ns.stock.getMaxShares(index) let max_history = 40 let fee = 100000 while (true) { let money = (ns.getServerMoneyAvailable( "home") - Gebühr) * 0.9 let price = ns.stock.getPrice(index) let my_shares = ns.stock.getPosition(index)[0] ns.clearLog() if (history.length > (max_history - 1) ) { if (price > Math.max(...history)) { let buy = Math.floor((money / price)) if ((buy + my_shares) > max_shares) { buy = max_shares - my_shares } if (buy > 0 && (Preis * Kauf) > 10000000) { ns.print("Buy(Long): " + ns.stock.buy(index, buy)) } } else if (price < Math.min(...history )) { if (my_shares > 0) { ns.print("Sell(Long): " + ns.stock.sell(index, my_shares)) } } } history.splice(0, 0, price) if (history.length > max_history) { history.pop() } let profit = ns.stock.getSaleGain(index, my_shares, "Long") ns.print("Index: " + index) ns.print("Max. Aktien: " + round(max_shares)) ns.print("Meine Long-Aktien: " + round(ns.stock.getPosition(index)[0])) ns.print("Preis : $" + round(price)) ns.print("Gespeicherter Verlauf: " + history.length) ns.print("Höchster Preis: $" + round(Math.max(...history))) ns.print ("Niedrigster Preis: $" + round(Math.min(...history))) ns.print("------------------------ -") ns.print("Profit: $" + round(profit)) ns.print("--------------------") while (price == ns.stock.getPrice(index)) { await ns.sleep(100) } } }
BN8.2-3 & BN8 + Leistung
function round(value) { let characters = ["", "k", "m", "b", "t", "q"] let which = 0 while (value > 999 || value < -999) { Wert = Math.round(Wert / 10) / 100 ++was } Rückgabewert + Zeichen[was] } /** @param {NS} ns */ export async function main(ns) { ns.disableLog("ALL" ) let index = ns.args[0] // sollte FSIG oder FLCM sein let history = [] let max_shares = ns.stock.getMaxShares(index) let max_history = 40 let fee = 100000 while (true) { let money = ( ns.getServerMoneyAvailable("home") - Gebühr) * 0.9 let price = ns.stock.getPrice(index) let my_shares = ns.stock.getPosition(index)[0] let my_shorts = ns.stock.getPosition(index)[ 2] ns.clearLog() if (history.length > (max_history - 1)) { if (price > Math.max(...history)) { if (my_shorts > 0) { ns.print("Sell(Short ): " + ns.stock.sellShort(index, my_shorts)) } let buy = Math.floor((money / price)) if ((buy + my_shares) > max_shares) { buy = max_shares - my_shares } if (buy > 0 && (Preis * Kauf) > 10000000) { ns.print("Buy(Long): " + ns.stock.buy(inde x, buy)) } } else if (price < Math.min(...history)) { if (my_shares > 0) { ns.print("Sell(Long): " + ns.stock.sell(index, my_shares)) } if (my_shorts == 0) { let buy = Math.floor(((ns.getServerMoneyAvailable("home") - fee) / price)) if (buy > max_shares) { buy = max_shares } ns.print ("Buy(Short): " + ns.stock.short(index, buy)) } } } history.splice(0, 0, price) if (history.length > max_history) { history.pop() } Let profit if (my_shares > my_shorts) { profit = ns.stock.getSaleGain(index, my_shares, "Long") } else { profit = ns.stock.getSaleGain(index, my_shorts, "Short") } ns.print("Index: " + index) ns.print("Max. Aktien: " + round(max_shares)) ns.print("Meine Long-Aktien: " + round(ns.stock.getPosition(index)[0])) ns.print(" Meine Short-Aktien: " + round(ns.stock.getPosition(index)[2])) ns.print("Preis: $" + round(price)) ns.print("Gespeicherter Verlauf: " + history.length) ns.print("Höchster Preis: $" + round(Math.max(...history))) ns.print("Niedrigster Preis: $" + round(Math.min(...history))) ns. drucken(" -------------------------") ns.print("Profit: $" + round(profit)) ns.print("--- ----------------------") while (price == ns.stock.getPrice(index)) { await ns.sleep(100) } } }
Das ist alles, was wir heute dafür teilen Bitbrenner führen. Dieses Handbuch wurde ursprünglich erstellt und geschrieben von Verdammt. Falls wir dieses Handbuch nicht aktualisieren, finden Sie das neueste Update, indem Sie diesen folgen Link.