Basic Script for BN8.1 Advanced Script for BN8.2-3 & BN8+ Achievement in Bitburner.
BN8.1
function round(wartość) { let signs = ["", "k", "M", "B", "T"] let which = 0 chwila (wartość > 999 || wartość < -999) { value = Math.round(wartość / 10) / 100 ++Który } return value + znaki[Który] } /** @param {Ns} ns */ Eksportuj funkcja asynchroniczna główna(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 chwila (PRAWDA) { let money = (ns.getServerMoneyAvailable("dom") - fee) * 0.9 let price = ns.stock.getPrice(index) let my_shares = ns.stock.getPosition(index)[0] ns.clearlog() Jeśli (history.length > (max_history - 1)) { Jeśli (price > Math.max(...history)) { let buy = Math.floor((pieniądze / price)) Jeśli ((kupić + my_shares) > max_shares) { buy = max_shares - my_shares } Jeśli (kupić > 0 && (price * kupić) > 10000000) { ns.print("Kupić(Long): " + ns.stock.buy(index, kupić)) } } else if (price < Math.min(...history)) { Jeśli (my_shares > 0) { ns.print("Sprzedać(Long): " + ns.stock.sell(index, my_shares)) } } } history.splice(0, 0, price) Jeśli (history.length > max_history) { history.pop() } let profit = ns.stock.getSaleGain(index, my_shares, "Long") ns.print("Indeks: " + index) ns.print("Max Shares: " + okrągły(max_shares)) ns.print("My Long Shares: " + okrągły(ns.stock.getPosition(index)[0])) ns.print("Cena: $" + okrągły(price)) ns.print("History saved: " + history.length) ns.print("Highest Price: $" + okrągły(Math.max(...history))) ns.print("Lowest Price: $" + okrągły(Math.min(...history))) ns.print("-------------------------") ns.print("Zysk: $" + okrągły(profit)) ns.print("-------------------------") chwila (price == ns.stock.getPrice(index)) { await ns.sleep(100) } } }
BN8.2-3 & BN8 + Osiągnięcie
function round(wartość) { let signs = ["", "k", "M", "B", "T", "q"] let which = 0 chwila (wartość > 999 || wartość < -999) { value = Math.round(wartość / 10) / 100 ++Który } return value + znaki[Który] } /** @param {Ns} ns */ Eksportuj funkcja asynchroniczna główna(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 chwila (PRAWDA) { let money = (ns.getServerMoneyAvailable("dom") - 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() Jeśli (history.length > (max_history - 1)) { Jeśli (price > Math.max(...history)) { Jeśli (my_shorts > 0) { ns.print("Sprzedać(Short): " + ns.stock.sellShort(index, my_shorts)) } let buy = Math.floor((pieniądze / price)) Jeśli ((kupić + my_shares) > max_shares) { buy = max_shares - my_shares } Jeśli (kupić > 0 && (price * kupić) > 10000000) { ns.print("Kupić(Long): " + ns.stock.buy(index, kupić)) } } else if (price < Math.min(...history)) { Jeśli (my_shares > 0) { ns.print("Sprzedać(Long): " + ns.stock.sell(index, my_shares)) } Jeśli (my_shorts == 0) { let buy = Math.floor(((ns.getServerMoneyAvailable("dom") - fee) / price)) Jeśli (kupić > max_shares) { buy = max_shares } ns.print("Kupić(Short): " + ns.stock.short(index, kupić)) } } } history.splice(0, 0, price) Jeśli (history.length > max_history) { history.pop() } let profit if (my_shares > my_shorts) { profit = ns.stock.getSaleGain(index, my_shares, "Long") } w przeciwnym razie { profit = ns.stock.getSaleGain(index, my_shorts, "Short") } ns.print("Indeks: " + index) ns.print("Max Shares: " + okrągły(max_shares)) ns.print("My Long Shares: " + okrągły(ns.stock.getPosition(index)[0])) ns.print("My Short Shares: " + okrągły(ns.stock.getPosition(index)[2])) ns.print("Cena: $" + okrągły(price)) ns.print("History saved: " + history.length) ns.print("Highest Price: $" + okrągły(Math.max(...history))) ns.print("Lowest Price: $" + okrągły(Math.min(...history))) ns.print("-------------------------") ns.print("Zysk: $" + okrągły(profit)) ns.print("-------------------------") chwila (price == ns.stock.getPrice(index)) { await ns.sleep(100) } } }
To wszystko, co dzisiaj udostępniamy w tym celu Bitburnera przewodnik. Ten przewodnik został pierwotnie stworzony i napisany przez LorDamned. Na wypadek, gdybyśmy nie zaktualizowali tego przewodnika, możesz znaleźć najnowszą aktualizację, postępując zgodnie z tym połączyć.