Menu

3,000+ stock pages that never call an API at request time
📰

3,000+ stock pages that never call an API at request time

DEV Community: node·David·4 days ago
#OYsILFC6
#devtonodejs#devto#dev#pages#stock
Reading 0:00
15s threshold

I run Stockinsky , a small site that writes paid AI research reports on listed companies. Most companies will never get a paid report, but people still search for them by name. So I added a free page for every stock: ten years of financials, a red-flag checklist, dividend history and the latest close.

There are now about 2,000 China A-share pages, plus around 530 Hong Kong and 530 U.S. ones. Here is how they are built, and the one incident that shaped the design.

The rule: a page view never touches an upstream API

The first version fetched data when someone opened a page and cached the result. That works fine for people. It does not work for crawlers. A search engine bot can open hundreds of stock pages in a few minutes, and every cache miss turns into several requests to free market-data endpoints.

Then I made it worse myself. I ran a bulk measurement script on the production server , and the quote provider started rate-limiting the server's IP. Live quotes on the site broke for real users.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.