Workspace / Research tools
Portfolio research

Historical VaR and Expected Shortfall Calculator

Historical value at risk and expected shortfall answer different questions about the losses in a return sample. This tool reports a selected loss quantile and the average of a fixed number of worst observations. Use it to inspect how a few severe periods influence a Bitcoin strategy, a portfolio, or a research scenario. The confidence setting describes the historical sample calculation; it does not promise that future losses remain within the displayed amount.

Enable JavaScript to edit assumptions, calculate and compare a baseline locally. The formula and methodology below remain available without JavaScript.

The exact empirical convention

Enter periodic returns as percentages. Convert each return r into a loss L = −r and sort losses in ascending order. For confidence c and sample size N, VaR is the observation at zero-based index ceil(c × N) − 1. Expected shortfall averages the largest k = ceil((1 − c) × N) losses. Tail membership uses this count independently of ties at VaR, so repeated threshold values do not silently expand the tail.

A five-observation example

Suppose returns are −8%, −3%, 1%, 2%, and 4%. Ordered losses are −4%, −2%, −1%, 3%, and 8%. At 80% confidence, nearest-rank VaR is the fourth loss, or 3%. The tail count is one, so expected shortfall is 8%. At 60% confidence, the tail contains two losses and their average is 5.5%. These small examples illustrate the convention rather than a statistically reliable risk estimate.

What a negative loss estimate means

If every supplied return is positive, VaR and expected shortfall can both be negative: even the worst sampled outcomes were gains. The tool preserves that information instead of replacing it with zero. Results retain the input period and are not automatically scaled to a different horizon. A short or selectively chosen history can omit exchange failures, liquidity shocks, and changing exposures. This implementation is a descriptive empirical estimator, not a Basel capital calculation.

Primary documentation

Your research workspace

Save selected inputs and research notes explicitly in this browser. Compare assumptions and restore a saved setup without submitting a trade. JavaScript enables the controls.

Find a tool or research page