As you've pointed out, the other question you linked to is more about how to render a nice graph and numerical change, and not how to decide exactly how or why the number should change. It just states...
- You start at time T1. You're going towards time T2. Price at time T1 is P1. P2 is end price.
- You generate a random number (probably based on some events, maybe?) for P2. This is your larger number target price.
Obviously you don't want a random number, you want a stock market model to tell you what P2 should be. And what that value is can be influenced by a market simulator and also player actions that impact the simulator's outcome.
To that end (how to model and simulate a stock market) I think you're going to have to go deep and learn more about actual stock market simulators outside of the game space.
Below are a few links to reading on this topic, that I think should help get you further down the path of how a market simulator works, what the inputs to it are, etc.
Modeling and Simulation of the Artificial Stock MarketTrading System
Multi-agent modeling and simulation of a stock market
Wikipedia Stock market simulator page
You might also check out the MarketWatch virtual stock exchange at https://www.marketwatch.com/game. No source code but it should be a good learning experience to see how this is done in other games/simulators.
Lastly, you might find this previous question in a different stack somewhat useful: https://softwareengineering.stackexchange.com/questions/84490/what-algorithms-would-be-useful-for-designing-a-stock-market-simulator
In the end, this is potentially a pretty complex problem if you truly want an accurate simulation.