Basic Script for BN8.1 Advanced Script for BN8.2-3 & BN8+ Achievement in Bitburner.
BN8.1
function round(valor) { let signs = ["", "k", "metro", "b", "t"] let which = 0 mientras (valor > 999 || valor < -999) { value = Math.round(valor / 10) / 100 ++cual } return value + señales[cual] } /** @param {Ns} ns */ export async function main(ns) { ns.disableLog("TODO") let index = ns.args[0] // should be FSIG or FLCM let history = [] let max_shares = ns.stock.getMaxShares(índice) let max_history = 40 let fee = 100000 mientras (verdadero) { let money = (ns.getServerMoneyAvailable("hogar") - tarifa) * 0.9 let price = ns.stock.getPrice(índice) let my_shares = ns.stock.getPosition(índice)[0] ns.clearLog() si (history.length > (max_history - 1)) { si (price > Math.max(...historia)) { let buy = Math.floor((dinero / price)) si ((comprar + my_shares) > max_shares) { buy = max_shares - my_shares } si (comprar > 0 && (price * comprar) > 10000000) { ns.print("Comprar(Long): " + ns.stock.buy(índice, comprar)) } } de lo contrario si (price < Math.min(...historia)) { si (my_shares > 0) { ns.print("Vender(Long): " + ns.stock.sell(índice, my_shares)) } } } history.splice(0, 0, price) si (history.length > max_history) { history.pop() } let profit = ns.stock.getSaleGain(índice, my_shares, "Long") ns.print("Índice: " + índice) ns.print("Max Shares: " + redondo(max_shares)) ns.print("My Long Shares: " + redondo(ns.stock.getPosition(índice)[0])) ns.print("Precio: $" + redondo(price)) ns.print("History saved: " + history.length) ns.print("Highest Price: $" + redondo(Math.max(...historia))) ns.print("Lowest Price: $" + redondo(Math.min(...historia))) ns.print("-------------------------") ns.print("Ganancia: $" + redondo(ganancia)) ns.print("-------------------------") mientras (price == ns.stock.getPrice(índice)) { await ns.sleep(100) } } }
BN8.2-3 & BN8 + Logro
function round(valor) { let signs = ["", "k", "metro", "b", "t", "q"] let which = 0 mientras (valor > 999 || valor < -999) { value = Math.round(valor / 10) / 100 ++cual } return value + señales[cual] } /** @param {Ns} ns */ export async function main(ns) { ns.disableLog("TODO") let index = ns.args[0] // should be FSIG or FLCM let history = [] let max_shares = ns.stock.getMaxShares(índice) let max_history = 40 let fee = 100000 mientras (verdadero) { let money = (ns.getServerMoneyAvailable("hogar") - tarifa) * 0.9 let price = ns.stock.getPrice(índice) let my_shares = ns.stock.getPosition(índice)[0] let my_shorts = ns.stock.getPosition(índice)[2] ns.clearLog() si (history.length > (max_history - 1)) { si (price > Math.max(...historia)) { si (my_shorts > 0) { ns.print("Vender(Short): " + ns.stock.sellShort(índice, my_shorts)) } let buy = Math.floor((dinero / price)) si ((comprar + my_shares) > max_shares) { buy = max_shares - my_shares } si (comprar > 0 && (price * comprar) > 10000000) { ns.print("Comprar(Long): " + ns.stock.buy(índice, comprar)) } } de lo contrario si (price < Math.min(...historia)) { si (my_shares > 0) { ns.print("Vender(Long): " + ns.stock.sell(índice, my_shares)) } si (my_shorts == 0) { let buy = Math.floor(((ns.getServerMoneyAvailable("hogar") - tarifa) / price)) si (comprar > max_shares) { buy = max_shares } ns.print("Comprar(Short): " + ns.stock.short(índice, comprar)) } } } history.splice(0, 0, price) si (history.length > max_history) { history.pop() } let profit if (my_shares > my_shorts) { profit = ns.stock.getSaleGain(índice, my_shares, "Long") } demás { profit = ns.stock.getSaleGain(índice, my_shorts, "Short") } ns.print("Índice: " + índice) ns.print("Max Shares: " + redondo(max_shares)) ns.print("My Long Shares: " + redondo(ns.stock.getPosition(índice)[0])) ns.print("My Short Shares: " + redondo(ns.stock.getPosition(índice)[2])) ns.print("Precio: $" + redondo(price)) ns.print("History saved: " + history.length) ns.print("Highest Price: $" + redondo(Math.max(...historia))) ns.print("Lowest Price: $" + redondo(Math.min(...historia))) ns.print("-------------------------") ns.print("Ganancia: $" + redondo(ganancia)) ns.print("-------------------------") mientras (price == ns.stock.getPrice(índice)) { await ns.sleep(100) } } }
Eso es todo lo que estamos compartiendo hoy para este Quemador de bits guía. Esta guía fue originalmente creada y escrita por LorDamned. En caso de que no actualicemos esta guía, puede encontrar la última actualización siguiendo este enlace.