Your first screen, through the proxy
By the end of this lesson you will have a /screen page beside your watchlist that renders one screen with two filters of your own — from a fixture in mock mode, then once live — with the data date above the rows, and that names the filter when the API rejects one.
Time to cut a market down to a handful of names. Same rule as always: the request goes through your own server, never from the browser.
Build Your First Tool pointed you at the academy's reference for choosing a column. Use it the same way here, one level up: /screener is one of roughly ninety endpoints, and the reference lists each against the market question it answers. Confirming that this is the right one takes a minute; discovering it was not, after you have built a table around its response shape, takes an afternoon.
The shape of a screen
/screener takes filters, a sort and a limit, and answers in one request:
/screener
?filters=[["market_capitalization",">",1000000000],["exchange","=","us"]]
&sort=market_capitalization.desc
&limit=2
The filters are JSON, url-encoded, and each one is a triple: field, operator, value. Through your proxy the same request is:
const filters = JSON.stringify([
["market_capitalization", ">", 1_000_000_000],
["exchange", "=", "us"],
]);
const res = await fetch(
`/api/proxy/screener?filters=${encodeURIComponent(filters)}` +
`&sort=market_capitalization.desc&limit=2`,
);
Run on 2026-08-25 that returned, exactly:
{"data":[
{"code":"NVDA","name":"NVIDIA Corporation","last_day_data_date":"2026-08-24",
"adjusted_close":208.48,"refund_1d":-6.24,"refund_1d_p":-2.91,
"market_capitalization":5049593888768,"earnings_share":6.34,
"dividend_yield":0.0002,"sector":"Technology","industry":"Semiconductors",
"avgvol_1d":135187288,"avgvol_200d":164865302.27},
{"code":"AAPL","name":"Apple Inc.", "...": "..."}
]}
Three things in that response worth stopping on
It is wrapped. The rows are under a data key. Most endpoints in this API answer with a bare array; this one does not. Code that does body.map(...) on the response object throws a TypeError, because an object has no map. Code that checks body.length is worse: an object has no length either, so it gets undefined, nothing throws, and the page quietly shows nothing, which is the worst kind of wrong.
last_day_data_date is 2026-08-24, not today. A screen runs on the last completed session, not on live prices. That is correct behaviour and it must appear on your screen, because a person reading a list of "cheapest stocks" deserves to know it is yesterday's cheapest.
dividend_yield is 0.0002. Not 0.02%. Not 2%. It is a fraction: 0.0002 means 0.02%. Render it raw beside a percentage sign and you have understated every yield by a hundred times. Reviewing for numbers that lie is about exactly this class of error; note it now, because you will meet it again.
One request, and what it costs
A screen is a single request regardless of how many rows come back, and limit=500 was verified to return 500 rows in one request on 2026-08-25.
That makes screening cheap per result and expensive per attempt — and attempts are what you make while tuning filters. Twenty tweaks while getting a screen right is twenty requests, and a /screener request costs 5 calls (measured 2026-08-26), so about 100 calls, which on a small allowance is a real bite out of a morning. Your meter is on screen already; watch it while you experiment.
Read the errors, they are unusually specific
Ask for a field that does not exist and the API tells you precisely which part of your filter is wrong:
{"errors":{"filters.0.field":["The selected filters.0.field is invalid."]}}
Note the shape: an errors object keyed by the path into your input. This is a different error envelope from the plain message other endpoints return, and code that only knows how to read one of them will show a person "undefined". Handle both, and surface the path: even the raw filters.0.field is something a person can act on, and "filter 1: unknown field" is better still.
The finance behind it
Your filters compare companies to each other, which is only fair under conditions this lesson does not cover: How do you compare two companies fairly?
Try it now
Get one screen rendering through your own server with two filters of your own.
The prompt
Mock mode on, plan mode on, and paste:
Add a screener page at src/app/screen/page.tsx, rendered on the server
like the watchlist, and put the request in a new src/lib/screens.ts:
one eodhdFetch("screener", ...) with two filters (earnings_share > 0
and exchange = us), a sort by market_capitalization descending and
limit 10. The rows arrive under a data key: the answer looks like
{"data":[{"code":"NVDA","name":"NVIDIA Corporation",
"last_day_data_date":"2026-08-24","adjusted_close":208.48,
"refund_1d_p":-2.91,"market_capitalization":5049593888768,
"earnings_share":6.34,"dividend_yield":0.0002,"sector":"Technology",
"industry":"Semiconductors","avgvol_1d":135187288}]}. Show
last_day_data_date above the table. If the answer is an errors object
such as {"errors":{"filters.0.field":["The selected filters.0.field is
invalid."]}}, show each path and message instead of a table. Every
message on this page is about the screen, never advice about the
watchlist's tickers. For mock
mode, add fixtures/screener.json with ten rows of that shape and
invented numbers. Add a test for the part that reads the rows. Before
writing the fetch, tell me what one live load of the page costs, from
estimateCalls(). Done means npm test, npm run typecheck, npm run lint
and npm run check:leak green; then show me the diff.
The watchlist asks on the server, so the screen does too: the fetch above is the same request seen from a browser. A good answer adds a screens module, a localhost:3000/screen page, a fixture and a test, leaves the watchlist working as before, and prices a live load at five calls. Moving the notices both pages need out of the watchlist page into a shared component is expected: the diff then shows lines leaving src/app/page.tsx, and the watchlist looks the same. The two filters are a suggestion: EODHD's screener endpoint cannot filter by instrument type, so these two keep to US companies with earnings; swap either for one of your own once it works.
Check it yourself
- In mock mode, localhost:3000/screen shows your fixture's rows with the data date above them.
- In
src/lib/screens.tsthe rows are read fromdata, not from the body itself. - The filters reach
eodhdFetchas a plain JSON string. It encodes parameters itself, so anencodeURIComponentthere would encode them twice. - Mock mode off, reload once: live rows, and
curl -s localhost:3000/api/usageread before and after showsusedup by five. This step needs your own key on a plan that includes EODHD's screener (All-In-One or EOD+Intraday — All World Extended; the free plan does not): the shareddemokey answers 403 on the screener endpoint, and its counter moves with other people's requests. On mock,demoor a free key skip it; the page will say that EODHD rejected the key, or that the plan does not cover the screener. Read that message: it talks about the screen, and does not tell you to remove tickers from the watchlist.
Break it on purpose
This one has to be live, because the fixture answers every screen the same way (it needs a key on a plan with the screener; demo also names a misspelled field, because the API validates the field before it checks the plan). Misspell a field name and look at what your UI shows. If it says "something went wrong" rather than naming the filter, you have thrown away the most useful error message in this API.
Compare with ours
// src/lib/screens.ts: the request, and the two shapes it answers with
const res = await eodhdFetch("screener", {
filters: JSON.stringify(filters), // encoded by eodhdFetch, once
sort: "market_capitalization.desc",
limit: "10",
});
if (!res.ok) {
// keyed by filters.0.field; a 401 or 402 body may not be JSON at all
return { status: res.status, errors: errorList(await res.json().catch(() => null)) };
}
const { data } = (await res.json()) as { data?: unknown }; // wrapped
return { rows: Array.isArray(data) ? data.filter(isScreenRow) : [] };
The full state at the end of this unit is on the starter's branch ref/build-a-screener/u1.

Checkpoint
npm test && npm run typecheck
git status # only your changes, and no .env* file
git add -A
git commit -m "First screen on the server: two filters, data date shown, filter errors named"
Then answer this lesson's questions.