I am currently developing a financial system on Roblox Studio
and want to get market data (such as open and close prices for certain stock on certain date).
To save the limited external API resource,
I want to save the data in Data Store only once a day automatically
so that players can get the market data from the Data Store as many times as they want.
But I don’t know how and where I can code it.
Does anyone has a good idea?
In whatever table you’re saving the data to, you could also save the servers’ os.time() and UTC timezone offset when it was last updated. Servers could then update if it it’s been 24 hours since. However, with the API request limitation for HttpService being 500 requests/minute per server, would you realistically exceed that just polling the price of a stock every now and then?
Thank you for your reply.
For API request limitation for Data Store, I am ok with it
Because I am not thinking of minute or second charts, but only daily chart now.
And so I want my data store access the external API just once a day
(maybe when US stock market closes)
If I write a code of HTTP Request on a server script within the game,
it means whenever a player open the game, HTTP Request is made,
which I don’t want because it is likely the external API is consumed pretty soon.
Ok, so you should log when the price was last updated into the datastore, and update if its beyond 24 hours old. You can find out how to log the time from the os reference