danielyxie / bitburner

Bitburner Game
https://danielyxie.github.io/bitburner/
2.8k stars 773 forks source link

Invalid stock symbol for any symbol in most stock functions #4184

Closed NoctalIvan closed 2 years ago

NoctalIvan commented 2 years ago

Version : v2.1.0 Noticed today (I'm new so I didn't play stocks until now)

In stock API, for any stock I tried, any stock function I tried crashes with error Invalid stock symbol

Repro step :

Expected : price got Actual : crash with Invalid stock symbol

Issue exists also with every stock method I tried which took a symbol as a parameter (getPrice, getEstimation, getVolatility)

image image

Having a blast on BitBurner, cheers from France !

Snarling commented 2 years ago

This is because FISG is not a valid stock symbol.

The "bug" is that the documentation lists invalid symbol FISG as the example stock symbol in the getPrice usage example.

Draco18s commented 2 years ago

It should be FSIG for Four Sigma

quacksouls commented 2 years ago

This is probably a weirdness (or bug?) related to the version of Bitburner you used to export your save file. Attached is a save file that I'm sure was exported using a version prior to v2.1.0. It's the file BN1x4_SQLInject.json from here:

https://github.com/quacksouls/bitburner/tree/main/data/program/intelligence

Load the attached save file into the online version of the game. Create this script:

/** @param {NS} ns */
export async function main(ns) {
    // The price of a stock.  Require the following:
    //
    // (1) A WSE account.
    // (2) Access to the TIX API.
    const sym = ns.stock.getSymbols()[0];
    ns.tprint(sym);
    ns.tprint(ns.stock.getPrice(sym));
}

Run the script and I got the error in the attached image. Still using the given save file, export it to your computer. Now load your exported save file into the online version of the game. Run the script again.

pre-v2.1.json.zip getPrice-error

Draco18s commented 2 years ago

I'm running on a save exported from 2.0.2 (something wonky happened overnight that caused the stockmarket and contract generation from updating for 11 hours) and that script runs just fine for me.