r/webdev • u/wisesheets • Oct 23 '26
Discussion What financial data is actually safe to cache in a frontend app, and for how long?
If you're building anything that shows stock data, caching saves a lot of API calls, but each type of data goes stale on a very different schedule. Here's how I think about it.
End-of-day prices don't change after the close, so you can cache them until the next session's close. 15-minute-delayed quotes go stale fast, so a TTL of a minute or two during market hours makes sense, and you can cache longer when the market is closed. Fundamentals only change when a new filing lands or a filing gets amended, so caching them for a day or more is usually fine, as long as you can invalidate on new filings. Company metadata like names, tickers and sectors changes rarely, but ticker changes do happen.
The catch is that data licenses sometimes limit how long you can store or redisplay data, so check that too. How are others handling this, with a server-side cache, SWR on the client, or something else?
3
u/MrMathieus Oct 23 '26
What’s the purpose of the app? General trend tracking? High frequency trading? Testing tradies strategies?
And what do you mean by ‘safe’? Are we using exclusively public data?
There’s too little context in this post to add anything of relevance.
1
u/OrganizationLost3135 Oct 23 '26
Two subtle architectural traps that usually bite teams doing this:
1
u/muhammadatiqpm Oct 23 '26
You are really dealing with two separate constraints, and it helps to keep them apart: the data license is the ceiling, your users’ staleness tolerance is the floor. The TTL you pick has to fit between them — and in money products there is a third factor, because showing a wrong number does not just annoy users, it burns trust you rarely get back.
Practically, I tier it like this:
Two rules I would not break: the server stamps every payload with an as-of timestamp and the client displays it, so staleness is honest; and you log what was shown and when. Working on a tax-automation product taught me that “what exactly did the user see?” is eventually a compliance question, not a debugging question. Server-side caching costs more, but it is auditable — client caching is cheaper and impossible to prove after the fact.
Question back: have you actually read your provider’s redistribution and storage terms, or are the caching rules currently based only on the API docs?
3
u/[deleted] Oct 23 '26
[removed] — view removed comment
2
u/[deleted] Oct 23 '26
[removed] — view removed comment
0
u/[deleted] Oct 23 '26
[removed] — view removed comment
0
u/[deleted] Oct 23 '26
[removed] — view removed comment