HKUDS/Vibe-Trading · error · ValueError
no event could be measured; reasons: {reasons}
Error message
no event could be measured; reasons: {reasons} What it means
After per-event processing, if every event was dropped (window falls outside the data, estimation window has too few observations, etc.), event_study has no outcomes to aggregate and raises this error, enumerating each dropped event with its reason.
Source
Thrown at agent/src/quantlib/eventstudy.py:448
outcomes.append(
(
EventOutcome(
symbol=symbol,
event_date=index[position],
abnormal_returns=pd.Series(abnormal, index=relative_days, name=symbol),
car=car,
car_std_error=car_se,
standardised_car=standardised,
fit=fit,
),
est_residuals,
abnormal,
)
)
if not outcomes:
raise ValueError(
"no event could be measured; reasons: "
+ "; ".join(f"{s}@{d}: {r}" for s, d, r in dropped)
)
n_events = len(outcomes)
event_outcomes = [o[0] for o in outcomes]
ar_matrix = np.vstack([o.abnormal_returns.to_numpy() for o in event_outcomes])
aar = pd.Series(ar_matrix.mean(axis=0), index=relative_days, name="aar")
caar = pd.Series(np.cumsum(aar.to_numpy()), index=relative_days, name="caar")
cars = np.array([o.car for o in event_outcomes])
if n_events > 1:
car_sd = float(cars.std(ddof=1))
t_stat = float(cars.mean() / (car_sd / np.sqrt(n_events))) if car_sd > 0 else float("nan")
t_p = float(2 * student_t.sf(abs(t_stat), df=n_events - 1)) if np.isfinite(t_stat) else float("nan")
else:
t_stat, t_p = float("nan"), float("nan")
View on GitHub (pinned to 80ffdda44c)
Solutions
- Read the per-event reasons in the message: symbol@date: reason tells you exactly which constraint failed.
- Trim events whose date is earlier than estimation_window + estimation_gap + |start| periods into the sample, or extend the returns history backwards.
Example fix
# before
events = {"AAPL": ["2010-01-05"]} # too early for the sample
# after
min_days = estimation_window + estimation_gap + abs(event_window[0])
events = {s: [d for d in ds if returns.index.get_loc(d) >= min_days] for s, ds in events.items()} Defensive patterns
Strategy: try-catch
Validate before calling
min_days = estimation_window + estimation_gap + abs(event_window[0])
events = {s: [d for d in ds if returns.index.get_loc(d) >= min_days] for s, ds in events.items()} Try / catch
try:
res = event_study(...)
except ValueError as e:
if "no event could be measured" in str(e):
logger.warning("all events dropped: %s", e)
else:
raise Prevention
- Trim events too close to the sample start.
- Extend returns history backwards or shift the study window.
When it happens
Trigger: Event dates near the start of the sample such that the estimation window (event-relative days minus gap and window length) predates the first observation, or NaNs wiping out an estimation window for every event.
Common situations: Events at the very beginning of a backtest, a returns frame that starts later than expected after data-cleaning, or timezone shifts moving event dates outside the index.
Related errors
- estimation window needs at least {MIN_ESTIMATION_OBSERVATION
- market returns are constant over the estimation window, so b
- event_window start must be <= end, got {event_window}
- estimation_gap must be >= 0, got {estimation_gap}
- estimation_window must be at least {MIN_ESTIMATION_OBSERVATI
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/667ea8d80a22b56f.
Report an issue: GitHub.