bitburner-official / bitburner-src

Bitburner source code.
Other
842 stars 273 forks source link

Price of a stock freezes after it has reached absolute zero #946

Open cigarmemr opened 1 year ago

cigarmemr commented 1 year ago

Step to reproduce

  1. Build up strong hacking related stats, including hack level, hack time (reduction), hack power etc.
  2. Purchase 4S Market Data Access and Market Data TIX API Access
  3. Script hack()/grow() a server with corresponding stock with {stock: true} according to its forecast to make the price oscillate intensely.
  4. Wait and check its price.

Result

The price may eventually reach absolute zero and never changes from then on, making it non-sense to be traded any more (before soft reset) This happens mostly on stocks with:

namely JGN (Joe's Guns) and SGC (Sigma Cosmetics): image

Version

bitburner v2.5.0 (b87b8b4be)

Idea

This part of code prevents the stock price to go beyond certain cap. It might be possible to duplicate and modify them to prevent the price dropping below a certain threshold. Another idea I came up with is to log the count of zero in past prices. When it reaches certain value (5 or 10 continuous 0's as such), reset the stock to some reasonable price. Optionally forbid trading stocks with a price of 0 to prevent exploiting absurd profit through resetting.

d0sboots commented 1 year ago

The price of stocks moves geometrically. I.e. the price is being rounded to 0, but it is not actually 0; it can still recover from there with proper user action. The only way to get it that low is to make a severe mistake in your hacking scripts (adjusting the stock price down instead of up).

cigarmemr commented 1 year ago

Hopefully. Yet a more accurate observation is required for me. Will add them here when the time comes.

Kelenius commented 1 year ago

The only way to get it that low is to make a severe mistake in your hacking scripts (adjusting the stock price down instead of up).

That's not true. If you don't install augs for a long time, the prices randomly drift and some of them can end up near zero through pure randomness.

The price has an upper cap, there's no reason why it shouldn't have a lower cap as well.

cigarmemr commented 10 months ago

Confirmed. From the exported save file I can see the price is a number which gets very close to but not actually be zero: \"symbol\":\"JGN\",\"price\":1.5344874132287537e-8,

However the problem still exists: The price becomes nearly impossible to rise to some reasonable value again, rendering it "dead" until next soft reset.

Due to the flipping mechanism of 1st/2nd forecast, we can put {stock: true} in grow() but not in hack() to rise its forecast, but this will also render the forecast to be lower after flipping happens. So what we can control through scripts is the amplitude of price oscillation rather than the price itself.

Beside the ideas I've mentioned before, another idea I come up with is to do the following:

Both applies AFTER the price drifting from RNG.

As 0.001 is usually negligible comparing to normal price change, this shouldn't gives the player much more profit.