Simulate "fake" stock market in unity - C#


I couldn’t find any answer around here, therefor I dare ask :), what would be the best way to simulate a fake stock market (no retrieve from Yahoo or Google API) and make it move every second ?

The next step is to be able to see all the data in a bloomberg type of graph.

I am not really certain on how to begin with and what would be the most efficient way to proceed.

In a nutshell : start : 50 at time Xnow --> live : 50 + 0,02 at time Xnow+1.
Then : put that live into a graph updated every second.

Thanks for your help guys.

Well, I guess you could provide a massive array of the values at each second and just read them in, or you can create the data at runtime based on some algorithm. The best method depends on what your application actually is. If you intend to have this running over many years (game time), then coming up with some algorithm to generate the data is absolutely the way to go.

Should you want to provide data, then I’d consider reading and importing the data from a csv rather than hard-coding into the game. It’ll be much easier to manipulate during development in this way.

As for the graph, it should be relatively trivial as you’re just drawing a line from one point to another, and refreshing that periodically based on a given rage (last 100 values, last 10,000 values etc). Take a look at the LineRenderer as a starting point: Unity - Manual: Line Renderer component