The Lookback Window Problem in Concept-to-Stock Mention Rankings: Getting the days Parameter Right
"Which stocks are carrying the discussion around this theme right now?" is one of the most common questions people ask a heat monitoring dataset. In Lava, the answer comes from the concept member ranking: GET /concepts/stocks , exposed to agents as the MCP tool get_concept_stock_heat . It returns the stocks most mentioned by institutions and influencers under a given concept, along with how many…
When discussing which stocks are currently generating the most conversation around a particular theme, a common question is: <source>13b9d36e-6cb</source>. Lava's answer is provided through the concept member ranking endpoint: GET /concepts/stocks. This API returns the stocks that have been mentioned by institutions and influencers under a given concept, along with the number of distinct sources that have mentioned each stock.
The endpoint accepts a single parameter, days, which determines the lookback window and defaults to 30 days. Other parameters include a hard limit and a 10-minute refresh cycle. This single parameter is responsible for many confusion regarding why certain queries do not align. The concept name plays a crucial role in the ranking, and the endpoint can return up to 100 stocks per request.
The ranking is not an exhaustive list of all stocks related to the concept but rather a ranking of the stocks that have been mentioned in connection with the concept during the specified lookback period. The lookback window is a critical factor in shaping the results. A short lookback window of just one day will frequently change as positions 5 and 30 may differ by only one or two mentions.
In contrast, a longer lookback window of 90 days or more can keep the leader stable for weeks, even if new mentions are generated. To observe changes over time, multiple lookbacks should be compared together. Another important aspect to consider is that the days parameter is not the same as the window parameter. Comparing numbers from /hot/concepts with a 3-day window to the same endpoint with days=3 will yield different results because one is a rolling hourly window over the entire concept, and the other is a day-based lookback per member stock.
The ranking endpoint accepts a limited number of rows, which defaults to 50 and can go up to 100. There is no offset parameter, so if you want to see every mentioned member, you should label the table accordingly, such as top 100. The ranking updates approximately every ten minutes, so polling more frequently than every ten minutes will mostly return duplicate data and will also incur additional billing charges.
The ranking is sensitive to the exact name of the concept. For example, "Concept Alpha" may resolve while "Concept Alpha theme" or a variant with different spacing or full-width characters may return no results. It is essential to copy the canonical names from the /hot/concepts or /concepts/by-stock responses and maintain a local dictionary of these names.
Every snapshot taken with the days parameter requires saving the meta.server_time and meta.request_id with the snapshot to ensure that the data is not affected by the sliding window between two snapshots taken at different times. Finally, it is important to note that the ranking endpoint does not have an as_of_date parameter. Therefore, any ranking pulled today includes discussion that occurred after the date you might want to study.
If you want to analyze historical data, you should use alternative endpoints such as /panel/daily, /hot/weighted, or /agencies/pit to obtain point-in-time, score-weighted cross-sections.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.