Insights
Wikipedia Views API for Event-Driven Stock Research
Alphanume Team · August 1, 2026
Query Wikipedia attention by ticker and date, preserve the 30-observation baseline, and join it to a separately timed corporate-event table without calling attention sentiment or causation.
Alphanume's Wikipedia Views dataset serves daily English-Wikipedia page views for covered equities, plus a trailing mean and z-score. It is useful in event-driven research because it measures whether attention around a ticker was unusual relative to that page's own recent history.
The measurement says nothing about whether readers were bullish, bearish, confused, or simply following a news story. A high z-score can be an outcome of an event rather than a predictor of returns. The test needs an event clock, an attention window, and a return window defined before results are inspected.
Read the six served fields
Field | Meaning | Research use |
|---|---|---|
ticker | Equity symbol mapped to the article | Join key requiring identity review |
name | Wikipedia page name | Audit the article mapping |
date | Daily observation date | Attention clock |
views | User page views for that date | Raw attention level |
avg_30d | Trailing 30-observation mean | Ticker-specific baseline |
zscore_30d | Deviation from the trailing distribution | Comparable anomaly score |
The rolling baseline uses 30 prior observations and excludes the current row from its own mean and standard deviation. It is not necessarily 30 calendar days when a ticker has gaps. A row's stored z-score is frozen when first written, so archive the API response used in a study rather than silently recalculating a different statistic.
Retrieve one event window
The endpoint is GET /v1/wikipedia-views. Exact date cannot be mixed with range filters, and cursor pagination requires both returned cursor fields. This example requests one ticker around a known corporate event and preserves the full response.
import os
import requests
url = "https://api.alphanume.com/v1/wikipedia-views"
headers = {"X-API-Key": os.environ["ALPHANUME_API_KEY"]}
params = {
"ticker": "AAPL",
"date_gte": "2026-01-20",
"date_lte": "2026-02-10",
}
rows = []
while True:
response = requests.get(url, headers=headers, params=params, timeout=30)
response.raise_for_status()
payload = response.json()
rows.extend(payload["data"])
if not payload["has_more"]:
break
params["cursor_date"] = payload["next_cursor"]["date"]
params["cursor_ticker"] = payload["next_cursor"]["ticker"]For a market-wide anomaly screen, the endpoint also accepts filters such as zscore_30d_gte=2. Equality cannot be combined with z-score range filters. Save each raw page and reject a partial download before joining it to events.
Join on an explicit event clock
Give the corporate-event table one row per event with a public timestamp, source URL, and ticker identity as of that time. Expand each event into relative calendar dates and join on ticker plus observation date. Calendar offsets are appropriate for page views because Wikipedia reports daily calendar activity, while market returns need a separate trading calendar.
import pandas as pd
attention = pd.DataFrame(rows)
attention["date"] = pd.to_datetime(attention["date"])
events = pd.DataFrame([{
"event_id": "source-accession-or-id",
"ticker": "AAPL",
"public_date": pd.Timestamp("2026-01-29"),
}])
panel = events.merge(attention, how="left", on="ticker")
panel["relative_day"] = (panel["date"] - panel["public_date"]).dt.days
panel = panel.loc[panel["relative_day"].between(-7, 7)].copy()Do not forward-fill attention across missing dates. Report the number of events with complete pre-event and post-event windows, and keep unresolved article mappings in the denominator. A ticker change or company-name collision can otherwise attach the wrong page to an old event.
Choose a test that matches the claim
For a descriptive event study, compare each event's maximum post-disclosure z-score with its pre-event baseline and plot the median path by relative day. For a predictive study, use only attention observed before the trading decision and hold the event definition, threshold, and return horizon fixed.
The first design asks whether attention surrounded the event. The second asks whether attention available at the time predicts a later outcome. They use similar data and answer different questions. Keep them separate, and never interpret the sign of a stock return as the sentiment embedded in page views.
Control the missing mechanisms
- Article mapping. A company can rename, merge, or share an ambiguous page title.
- Attention source. Page views include readers with many motives and do not isolate investors.
- Data gaps. A 30-observation baseline can span more than 30 calendar days.
- Timing. Daily page views do not reveal the intraday moment when attention arrived.
- Multiple testing. Trying many z-score thresholds and windows can manufacture a result.
The dataset does not supply event labels, sentiment, prices, or causal identification. Pair it with a documented event source and an independently specified market-outcome pipeline. Free access provides a trailing 20-trading-session window ending one session behind the latest observation.
Reproduce one attention window
Read the Wikipedia Views API reference, choose 20 events from one event class, and export their source records, page mappings, raw attention rows, relative-day panel, and missing-window report. Verify five article names by hand before calculating the median attention path.
Then preregister one predictive variant using only pre-decision observations and a later holdout period. Publish attention and returns as separate outputs even if the relationship is flat. The value of the workflow is a dated attention measure with an auditable join, not a claim that attention mechanically forecasts price.