Basic Script for BN8.1 Advanced Script for BN8.2-3 & BN8+ Achievement in Bitburner.
BN8.1
function round(valor) { let signs = ["", "k", "m", "b", "t"] let which = 0 enquanto (valor > 999 || valor < -999) { value = Math.round(valor / 10) / 100 ++qual } return value + Sinais[qual] } /** @param {NS} ns */ export async function main(ns) { ns.disableLog("TODOS") 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 enquanto (verdadeiro) { let money = (ns.getServerMoneyAvailable("lar") - taxa) * 0.9 let price = ns.stock.getPrice(index) let my_shares = ns.stock.getPosition(index)[0] ns.clearLog() se (history.length > (max_history - 1)) { se (price > Math.max(...history)) { let buy = Math.floor((dinheiro / price)) se ((comprar + my_shares) > max_shares) { buy = max_shares - my_shares } se (comprar > 0 && (price * comprar) > 10000000) { ns.print("Comprar(Long): " + ns.stock.buy(index, comprar)) } } senão se (price < Math.min(...history)) { se (my_shares > 0) { ns.print("Vender(Long): " + ns.stock.sell(index, my_shares)) } } } history.splice(0, 0, price) se (history.length > max_history) { history.pop() } let profit = ns.stock.getSaleGain(index, my_shares, "Long") ns.print("Index: " + index) ns.print("Max Shares: " + redondo(max_shares)) ns.print("My Long Shares: " + redondo(ns.stock.getPosition(index)[0])) ns.print("Preço: $" + redondo(price)) ns.print("History saved: " + history.length) ns.print("Highest Price: $" + redondo(Math.max(...history))) ns.print("Lowest Price: $" + redondo(Math.min(...history))) ns.print("-------------------------") ns.print("Lucro: $" + redondo(lucro)) ns.print("-------------------------") enquanto (price == ns.stock.getPrice(index)) { await ns.sleep(100) } } }
BN8.2-3 & BN8 + Conquista
function round(valor) { let signs = ["", "k", "m", "b", "t", "q"] let which = 0 enquanto (valor > 999 || valor < -999) { value = Math.round(valor / 10) / 100 ++qual } return value + Sinais[qual] } /** @param {NS} ns */ export async function main(ns) { ns.disableLog("TODOS") 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 enquanto (verdadeiro) { let money = (ns.getServerMoneyAvailable("lar") - taxa) * 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() se (history.length > (max_history - 1)) { se (price > Math.max(...history)) { se (my_shorts > 0) { ns.print("Vender(Short): " + ns.stock.sellShort(index, my_shorts)) } let buy = Math.floor((dinheiro / price)) se ((comprar + my_shares) > max_shares) { buy = max_shares - my_shares } se (comprar > 0 && (price * comprar) > 10000000) { ns.print("Comprar(Long): " + ns.stock.buy(index, comprar)) } } senão se (price < Math.min(...history)) { se (my_shares > 0) { ns.print("Vender(Long): " + ns.stock.sell(index, my_shares)) } se (my_shorts == 0) { let buy = Math.floor(((ns.getServerMoneyAvailable("lar") - taxa) / price)) se (comprar > max_shares) { buy = max_shares } ns.print("Comprar(Short): " + ns.stock.short(index, comprar)) } } } history.splice(0, 0, price) se (history.length > max_history) { history.pop() } let profit if (my_shares > my_shorts) { profit = ns.stock.getSaleGain(index, my_shares, "Long") } outro { profit = ns.stock.getSaleGain(index, my_shorts, "Short") } ns.print("Index: " + index) ns.print("Max Shares: " + redondo(max_shares)) ns.print("My Long Shares: " + redondo(ns.stock.getPosition(index)[0])) ns.print("My Short Shares: " + redondo(ns.stock.getPosition(index)[2])) ns.print("Preço: $" + redondo(price)) ns.print("History saved: " + history.length) ns.print("Highest Price: $" + redondo(Math.max(...history))) ns.print("Lowest Price: $" + redondo(Math.min(...history))) ns.print("-------------------------") ns.print("Lucro: $" + redondo(lucro)) ns.print("-------------------------") enquanto (price == ns.stock.getPrice(index)) { await ns.sleep(100) } } }
Isso é tudo o que estamos compartilhando hoje para isso Bitburner guia. Este guia foi originalmente criado e escrito por LorDamned. Caso não atualizemos este guia, você pode encontrar a atualização mais recente seguindo este link.