Caching, rate limiting and graceful degradation for a live market data feed
A live trading terminal was hammering the Twelve Data API twice a second per tab and freezing on rate limits; we added caching, a credit budget and graceful back-off.
Click any image to view it full size
An online trading platform, built in PHP and JavaScript on cPanel hosting, had a visible and embarrassing fault: the live price charts froze. Not slowly degraded — froze, mid-session, for users watching a market.
We traced the price-fetching layer and found it had no caching and no rate limiting at all. Every open browser tab refreshed the live terminal twice per second, and every one of those refreshes went straight out to the Twelve Data API. Two users with three tabs each were enough to exhaust the plan's allowance, and when the limit hit, the charts simply stopped.
We also counted what the site was actually asking for: 34 active symbols, 24 of them requiring Twelve Data — far beyond the five to ten the client believed were in play, and structurally impossible to serve at that refresh rate on the Basic tier. That number, not the code, was the ceiling.
The fix was deployed and tested live on the client's site. He confirmed it and released the milestone: "Thanks a lot, Marc! Appreciate your fast and clean work... Left you a great review too!" — along with a clear picture of what his current API tier can and cannot support at his symbol count.
The platform's live price charts froze because the price-fetching layer had no caching or rate limiting, while the terminal refreshed twice a second in every open tab — exhausting the Twelve Data plan allowance almost immediately.
We added a server-side caching and rate-limiting layer between the platform and Twelve Data: shared quote caching, a per-minute and per-day credit budget, adaptive refresh pacing tied to remaining quota, automatic back-off that serves the last good price rather than stalling, and cached candle history. We also reported the true symbol count driving demand and what the current tier could realistically sustain.
The fix was deployed and tested live on the client's site; charts no longer freeze on rate-limit exhaustion. The client released the milestone, praised the fast and clean work, and left a review.
Category
Web Development
Industry
Online Trading
Year
2026
Components
0 repositories
Web Development
Elementor landing page, prototype-first, for a Melbourne property roadshow
Web Development
Bespoke theme, persistent multi-step order form and a wp-admin orders plugin
Web Development
Landing page builds, form delivery repair and conversion tracking across three client sites