IndexedDB-based caching for historical stock data β faster scans, fewer API calls.
TradePro stores historical OHLCV price data in your browser's IndexedDB database. The first time you run the Strategy Scanner or Pattern Recognition on a set of tickers, it fetches up to 5 years of daily data from Yahoo Finance via the Cloudflare Worker. That data is saved locally β the next scan loads directly from cache, skipping the API call entirely.
Before every API call, historical-data-service.js checks whether valid cached data already exists for the ticker and date range. "Valid" means the cache covers the requested range minus a 1-day tolerance (to handle weekends and holidays).
If the cache exists but is missing recent days, only the missing period is fetched. For example, if cache covers up to last Friday and today is Tuesday, only MonβTue is fetched and merged.
Once a month (configurable), the full dataset for a ticker is re-fetched to pick up split-adjusted prices. Yahoo Finance already adjusts for splits via adjclose, but a monthly refresh ensures the entire series stays accurate.
The strategy scanner progress bar shows live cache stats: how many tickers were served from cache vs. freshly fetched. Events cache-hit and cache-write are dispatched on window for real-time UI updates.
| Property | Value |
|---|---|
| Database name | stock-cache |
| Version | 1 |
| Store: prices | keyPath [ticker, date] β one row per ticker/day |
| Store: meta | keyPath ticker β last fetched timestamp, cache build date |
| Library | idb@8 (Jake Archibald's IndexedDB wrapper, ~1 KB) |
| Typical size | 800 tickers Γ 5 years β ~80β120 MB (fits comfortably in IndexedDB) |
| Browser support | All modern browsers (Chrome, Firefox, Safari, Edge) |
In the main app (index.html), open βοΈ Settings β API Configuration and scroll to the "πΎ Historical Data Cache" section. From there you can:
The first scan always fetches all data fresh β there is nothing in cache yet. Subsequent scans benefit from the cache. Consider running a full scan overnight to warm the cache.
Open Settings β Historical Data Cache and click Clear All Cache. The next scan will fetch everything fresh. This is also done automatically once a month per ticker.
This was a known bug (fixed in commit bf31d07). The cache now uses a 1-day tolerance and reads up to today's date. If you still see stale data, clear the cache for the affected ticker.
Yes β Strategy Scanner, Market Pattern Recognition, and Universal Market Scanner all share the same IndexedDB database. Data fetched on one page is available on all others.
Cookies and history are separate from IndexedDB. However, clearing "all site data" or using browser privacy tools that wipe storage will remove the cache.