Basic Script for BN8.1 Advanced Script for BN8.2-3 & BN8+ Achievement in Bitburner.
BN8.1
function round(value) { let signs = ["", "k", "M", "B", "T"] let which = 0 terwijl (value > 999 || value < -999) { value = Math.round(value / 10) / 100 ++welke } return value + tekenen[welke] } /** @param {NS} ns */ export async function main(ns) { ns.disableLog("ALL") let index = ns.args[0] // should be FSIG or FLCM let history = [] let max_shares = ns.stock.getMaxShares(index) let max_history = 40 let fee = 100000 terwijl (WAAR) { let money = (ns.getServerMoneyAvailable("thuis") - fee) * 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((geld / price)) if ((buy + my_shares) > max_shares) { buy = max_shares - my_shares } if (buy > 0 && (price * buy) > 10000000) { ns.print("Kopen(Long): " + ns.stock.buy(index, buy)) } } else if (price < Math.min(...history)) { if (my_shares > 0) { ns.print("Verkopen(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 Shares: " + ronde(max_shares)) ns.print("My Long Shares: " + ronde(ns.stock.getPosition(index)[0])) ns.print("Prijs: $" + ronde(price)) ns.print("History saved: " + history.length) ns.print("Highest Price: $" + ronde(Math.max(...history))) ns.print("Lowest Price: $" + ronde(Math.min(...history))) ns.print("-------------------------") ns.print("Winst: $" + ronde(profit)) ns.print("-------------------------") terwijl (price == ns.stock.getPrice(index)) { await ns.sleep(100) } } }
BN8.2-3 & BN8 + Prestatie
function round(value) { let signs = ["", "k", "M", "B", "T", "q"] let which = 0 terwijl (value > 999 || value < -999) { value = Math.round(value / 10) / 100 ++welke } return value + tekenen[welke] } /** @param {NS} ns */ export async function main(ns) { ns.disableLog("ALL") let index = ns.args[0] // should be FSIG or FLCM let history = [] let max_shares = ns.stock.getMaxShares(index) let max_history = 40 let fee = 100000 terwijl (WAAR) { let money = (ns.getServerMoneyAvailable("thuis") - fee) * 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("Verkopen(Short): " + ns.stock.sellShort(index, my_shorts)) } let buy = Math.floor((geld / price)) if ((buy + my_shares) > max_shares) { buy = max_shares - my_shares } if (buy > 0 && (price * buy) > 10000000) { ns.print("Kopen(Long): " + ns.stock.buy(index, buy)) } } else if (price < Math.min(...history)) { if (my_shares > 0) { ns.print("Verkopen(Long): " + ns.stock.sell(index, my_shares)) } if (my_shorts == 0) { let buy = Math.floor(((ns.getServerMoneyAvailable("thuis") - fee) / price)) if (buy > max_shares) { buy = max_shares } ns.print("Kopen(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 Shares: " + ronde(max_shares)) ns.print("My Long Shares: " + ronde(ns.stock.getPosition(index)[0])) ns.print("My Short Shares: " + ronde(ns.stock.getPosition(index)[2])) ns.print("Prijs: $" + ronde(price)) ns.print("History saved: " + history.length) ns.print("Highest Price: $" + ronde(Math.max(...history))) ns.print("Lowest Price: $" + ronde(Math.min(...history))) ns.print("-------------------------") ns.print("Winst: $" + ronde(profit)) ns.print("-------------------------") terwijl (price == ns.stock.getPrice(index)) { await ns.sleep(100) } } }
Dat is alles wat we vandaag hiervoor delen Bitburner gids. Deze handleiding is oorspronkelijk gemaakt en geschreven door LorDamned. Voor het geval we er niet in slagen deze handleiding bij te werken, U kunt de laatste update vinden door dit te volgen link.