Re: library, no. The head slave wants $500 for access to it, and I got a little tired of mining :shrug:
Re: giving orders to the other slaves, maybe clarify in dialog that you're permitted to use them for your own pursuits (similarly, the requirement of working 4 hours a day in the house to maintain trust/obedience isn't mentioned as far as I remember).
Re: charts, I think you're overthinking it. You don't need to interpolate over variable lengths of time, you just need to sample at fixed intervals before advancing variable amounts of time. Example: assuming current price is a function of in-game time, previous price and and some PRNG sample, or something along those lines: when you would advance in-game time, instead of immediately advancing the in-game clock by X minutes, first sample at the next fixed time interval (say, every 15th minute), push the samples to your price history data set; advance another interval, repeat, etc. until X - current time < interval. Then update game state and UI.
If your price sampling function does not work anything like that, consider refactoring :joy: But even if a huge pile of game state factors into spot price at any moment in time, advancing state a couple dozen short intervals instead of one large one per time advance is going to have a trivial impact on the game's performance as long as you don't update UI.
Similarly if you want to start with historical data, take your first sample at day zero - 30 days (or whatever), step through intervals until you reach day zero, then start the game.
If all that ain't gonna work for some reason you *could* just use plain ol' linear interpolation between two samples at arbitrary times and introduce a little wiggle into it however you like. Remember it's just a game. The point is to give the player some visualized notion of how the market changes over time and what kind of movement to expect, not to fool a stock broker into thinking he's looking at a real chart. (Edit: yes, your long-term simulation can be more detailed and constrained, and will have to be if you're trying to simulate/emulate a working economy; but the chart can be pretty fake and you'll get away with it).
For display just grab yourself a chart library. Don't go messing with writing it from scratch. It's not that hard, but it's a big waste of time as javascript's canvas API is very low-level and tedious to work with. E.g. chart.js will get the job done and is free/open source. All you have to do is give it a canvas element to draw to and your pile of data points, then tell it which properties to use for the axes. It has a few options for using bezier curves if you really want interpolation, but a candle chart would probably be more on-point anyway.
You can lay out your stored price samples in the same structure your chart library expects and then just pass your stored data to it directly - easy peasy.