@bugsysha My app is a coin tracking app and I need those prices to do some calculations. For example: Calculate the value of a users portfolio. So ask myself what is the best way to do this?
@SmokeTM if you don't need to track how the price changed over time, then I would get the latest prices and cache it forever. Then I would override cached values every time I successfully get new prices. If the retrieval of prices fails for any reason you still have the old prices.
@bugsysha I need to track the prices but what interval would be meaningful? Because the value of a users portfolio should be up to date, so I have to get the prices every minute or 5 minutes I dont know?
if you don't need to track how the price changed over time, then I would get the latest prices and cache it forever.
So if I get the prices every 5 minutes for example is it a good idea to cache them every time?
@SmokeTM by tracking prices I'm thinking of that you have to have history of the price value. What is meaningful for you and the app you are working on, I don't know that. If you can do it every minute. Sure, do it. But I can't know that.
@bugsyshaby tracking prices I'm thinking of that you have to have history of the price value.
With that you mean I should store all prices in db. So it is possible to then lets say draw a graph with that data? This will result in a very big db ?
@SmokeTM you can go back to my previous comment where I say, if you don't need to track how the price changed over time, then don't store them in the database. If you need to track the prices, and maybe build a graph to show how the price changed, then store them in database. Which one is it out of those two?
With that you mean I should store all prices in db. So it is possible to then lets say draw a graph with that data? This will result in a very big db ?
Well yes, storing lots of data means a big database. You can’t just magically store many prices over time, for many coins, for many users, and not expect that information to take up space somewhere.
To clarify the prices should be update to date or at least near to this. What is the best way to achive this? Command which reads the prices and caches them? So I could use them everywhere in my app?
@SmokeTM by saying that prices need to be updated you are not clarifying anything. Everyone would assume prices are updated especially in the app that deals with sensitive things like currency.
So what would you recommend me? I have a problem to find the right design for my app.
Is the approach command get data and then cache that data a good one?
@martinbean maybe I dont need to store all that data in db, because coinmarketcap provides the data for charts?