Skip to content
SphinxRisk
Sign in Create account
EN

How to calculate Value at Risk for your own portfolio

Historical VaR and CVaR from your own daily returns, worked step by step on a demo portfolio: what a bad day and a bad month cost, and where VaR misleads.

By Sphinx Risk · published 8 Oct 2026 · 10 min read

−1.87%
lost on one day in twenty, or more
−2.46%
the average beyond that line
−7.1%
lost in one month in twenty, or more

Value at Risk (VaR) at 95% is the loss that one trading day in twenty was worse than. To calculate it for your own portfolio, take the portfolio's daily time-weighted returns, sort them from worst to best and read the value at the 5% mark; multiply that percentage by today's market value to express it in money. On the Sphinx Risk demo portfolio that gives −1.87%, about 499 USD on a market value of 26,625.61 USD. The average of the days beyond that line — the conditional VaR, or expected shortfall — is −2.46%.

What follows works through the calculation on the demo's figures, shows the two choices that move the result most (the return series and the time horizon), and ends with where VaR misleads. Nothing here is a forecast. Every figure describes what the portfolio's own history did; the demo is seven invented holdings (four companies, a gold trust, a Treasury and a coin) with generated prices, measured by the same engine that measures a real account.

What VaR answers, and what it does not

VaR answers one narrow question: on an ordinary bad day, where do losses start? It is a threshold, not a worst case. At a 95% confidence level, one day in twenty is worse than the VaR by construction, and the calculation says nothing about how much worse.

That is why VaR is almost always paired with a second number, conditional VaR (CVaR), which looks past the threshold and averages what it finds there. Two portfolios can share the same VaR and hide very different disasters behind it. The useful pair of questions is therefore:

  1. Where do the bad days begin? (VaR)
  2. When they come, how bad are they on average? (CVaR)

A third question is answered by neither: how deep did the whole fall get, and how long did it last? That is drawdown, covered in How deep can a portfolio fall? and on maximum drawdown.

Step 1: get the right return series

The most common error in a do-it-yourself VaR is not in the percentile. It is in the returns fed into it.

Compute daily returns as the change in your account balance and every deposit looks like a gain, every withdrawal like a loss. A month in which you added 5,000 to a 20,000 account shows a spectacular "return" that never happened in the market. The remedy is the time-weighted return: each day's return is the change in the value of what you held, with cash flows taken out. Sphinx Risk rebuilds the portfolio day by day from your trades for exactly this reason; the method is set out on time-weighted return.

For each trading day, the daily return is:

rt = ( Vt − Ft − Vt−1 ) / Vt−1
  • rt — the portfolio's return on day t
  • Vt — the market value of the portfolio at the close of day t
  • Ft — the net cash flow on day t, valued at that day's closing prices: the quantity bought minus the quantity sold, times the close
  • Vt−1 — the market value at the close of the previous trading day
  • t — the index of the trading day

This is how a fund values its units. Money that comes in or goes out on day t is valued at that day's close, so it neither inflates nor dilutes the day it arrives and it starts to count from the next one. What is left in the numerator, Vt − Ft − Vt−1, is the profit that day made by what you already held at the previous close; the whole fraction is the return of those holdings. The price you actually paid for a purchase does not enter this return. It shows up in your profit and in the money-weighted return instead.

The demo portfolio has 1,561 daily returns computed this way.

Step 2: historical VaR — sort and read the 5% mark

With the series in hand, historical VaR needs no model at all:

VaR95% = − q0.05 ( r1, r2, …, rN )
  • VaR95% — the one-day Value at Risk at 95% confidence, written as a positive loss
  • q0.05 — the 5th percentile: the value below which 5% of the observations fall
  • r1 … rN — the portfolio's daily returns from Step 1
  • N — the number of daily returns in the sample

The minus sign turns a negative return into a positive loss. Many tools, Sphinx Risk among them, simply show the negative return itself.

On the demo:

  1. The 1,561 daily returns are sorted from worst to best.
  2. 5% of 1,561 is about 78 days. The return at that mark is −1.87%.
  3. Reading: on one trading day in twenty, the portfolio did at least that badly.

The same figure appears on the Value at Risk page, computed by the engine rather than by hand.

Two small conventions can change the last decimal: how the percentile is interpolated between two neighbouring observations, and whether every day weighs the same or recent days weigh more. Neither changes the reading. Both are reasons to compare VaR figures only when they were computed the same way.

The demo portfolio's 1,561 daily returns, from the worst to the best: one day in twenty fell beyond the line

Step 3: translate it into money

A percentage is easier to compare; a currency amount is easier to feel. Multiply by today's market value:

VaR in money = VaR95% × Vtoday
  • VaR95% — the one-day VaR from Step 2, as a fraction (1.87% is 0.0187)
  • Vtoday — the portfolio's current market value

For the demo, at a market value of 26,625.61 USD: 0.0187 × 26,625.61 ≈ 499 USD. On one trading day in twenty, at today's size, the portfolio's own history says the loss starts at about 499 USD.

Note what this assumes: that today's portfolio behaves like the history the percentile came from. If what you hold has changed a great deal, the history describes a portfolio you no longer own.

Step 4: look past the line with CVaR

CVaR, also called expected shortfall, averages every return that fell beyond the VaR:

CVaR95% = − ( 1 / K ) × Σ rt    over every day with rt ≤ q0.05
  • CVaR95% — the conditional Value at Risk at 95%, written as a positive loss
  • K — the number of daily returns at or below the 5th percentile
  • Σ — the sum, taken only over those K returns
  • rt — each daily return in that worst group
  • q0.05 — the 5th percentile from Step 2, the VaR line

On the demo, the worst 5% of days average −2.46%, about 654 USD at today's value (see conditional VaR). The bad days do not stop at −1.87%. On average they go about 31% deeper.

CVaR has a property VaR lacks. Artzner, Delbaen, Eber and Heath (1999) set out the conditions a "coherent" risk measure should meet; one of them is that combining two portfolios should never show more risk than the two measured separately. They show that VaR can fail it. Expected shortfall, in its standard form, satisfies it. Rockafellar and Uryasev (2000) then showed that CVaR can be minimised efficiently when building a portfolio. For bank trading books, the Basel Committee announced in January 2016 "a shift from value-at-risk to an expected shortfall measure of risk under stress", to capture tail risk more prudently. A private investor has no regulator to satisfy, yet the reasoning carries over: the average of the bad days says more than the point where they begin.

Historical or parametric?

The alternative to sorting returns is to assume they follow a normal distribution and derive VaR from the volatility:

VaRnormal95% ≈ z0.95 × σd − μd
  • VaRnormal95% — the one-day VaR at 95% under the normal assumption
  • z0.95 — about 1.645: the number of standard deviations that leaves 5% of a normal distribution in its left tail
  • σd — the standard deviation of the daily returns
  • μd — the mean daily return, small enough over one day that it is often dropped

The demo's daily standard deviation is 1.130%, which scaled by the square root of 252 gives its annualised volatility of 17.9%. The normal VaR is therefore about 1.645 × 1.130% ≈ 1.86%, very close to the historical −1.87%. The normal expected shortfall at 95% (about 2.063 standard deviations) comes to roughly 2.33%, a little milder than the historical −2.46%.

So for this portfolio, at 95%, the choice barely matters. That is common, and it is also the trap. A normal distribution fits the middle of most return series well and the far tail badly; the further out you look, the more the assumption costs. The demo's tails score 4.16 against a normal distribution's 3, meaning extreme days arrive more often than a bell curve allows — which is why kurtosis and skew are worth reading next to VaR. Historical VaR has the opposite weakness: it can only show losses the sample actually contains.

From a bad day to a bad month

A daily figure is hard to live with; most people think in months. There are two ways to get there.

The square-root-of-time rule scales the daily VaR by the square root of the number of days:

VaRh ≈ VaR1 × √h
  • VaRh — the VaR over a horizon of h trading days
  • VaR1 — the one-day VaR
  • h — the number of trading days in the horizon (21 for a month)
  • √h — the square root of h, about 4.58 for 21 days

The rule assumes daily returns are independent and identically, normally distributed.

Measuring the month directly takes every overlapping window of 21 sessions in the portfolio's history and reads the 5% mark of those monthly returns. This is how the engine does it.

On the demo, the direct measurement uses 1,541 overlapping windows: one month in twenty lost at least 7.1%, about 1,893 USD at today's value, and the average of those worst months was −10.8% (see what a bad month costs). The square-root rule applied to the daily −1.87% gives about −8.6%.

Here the scaled figure is the larger of the two. That deserves saying plainly, because the rule is often described as always too optimistic. It is not wrong in one fixed direction; it is an approximation resting on an assumption the direct measurement does not need. Where it becomes dangerous is when bad days arrive in runs, as they do in a crisis: a month of them then compounds in a way independent days would not, and scaling up the daily figure understates the month precisely when it matters. The sounder approach is to measure the horizon you care about from your own history, and to read the average of the worst months as well as the threshold. One caution: overlapping windows share most of their days, so 1,541 windows carry far less independent information than the count suggests.

Where VaR misleads

  • It is not a floor. At 95%, about 78 of the demo's 1,561 days were worse than −1.87%, by design. Treating VaR as the most you can lose is the single most expensive misunderstanding in risk management.
  • It depends on the window. A history that includes a crash gives a different VaR from one that does not. Read VaR together with the dates it covers.
  • 95% is a lenient cut. It describes ordinary bad days, not rare ones. With about 78 observations in the tail, anything much further out rests on very few data points.
  • It measures the portfolio you had. If the holdings changed recently, the history reflects the old mix.
  • It says nothing about duration. A −1.87% day is survivable; twenty of them in a row are another matter. For the depth and length of falls, use maximum drawdown — −32.0% on the demo — and time under water.
  • It hides where the risk comes from. One number for the whole portfolio does not say which holding drives it. In the demo, one holding with 30% of the money carries 62% of the risk; see Why a 30% position can be 62% of your risk.

Doing it with your own portfolio

The steps above fit in a spreadsheet: build the daily time-weighted return series (Step 1 is where most of the work lies), use a percentile function for VaR, and average the returns below it for CVaR. Then check how many observations you have. With less than a year or two of daily data, the tail holds too few days to say much.

In Sphinx Risk, importing your broker's trades is enough. The portfolio is rebuilt day by day, and VaR, CVaR and the monthly figures are computed on your own history by the same deterministic engine that produced the demo numbers above. The same habit of showing where each number comes from runs through the company pages — for example Apple's SEC accounts and DCF, where each assumption is traced to its source.

Sources

Questions people ask

How do I calculate Value at Risk for my portfolio?

Take the portfolio's daily time-weighted returns, sort them from worst to best and read the return at the 5% mark. That is the 95% one-day historical VaR as a percentage; multiply it by today's market value to express it in money.

What is the difference between VaR and CVaR?

VaR is where the bad days begin: the loss that one day in twenty was worse than. CVaR (conditional VaR, also called expected shortfall) is the average of those worse days, so it says how bad the bad days actually were. On the demo portfolio the two are −1.87% and −2.46%.

Is Value at Risk the most I can lose?

No. At 95%, roughly one day in twenty is worse than the VaR by definition, and nothing in the calculation limits how much worse. Reading VaR as a floor is the most common and most expensive mistake made with it.

Can I turn a daily VaR into a monthly VaR with the square root of 21?

Only by assuming that daily returns are independent and normally distributed. Measuring the month directly, on overlapping 21-session windows of the portfolio's own history, avoids that assumption. On the demo portfolio the direct measurement gives −7.1% and the square-root rule about −8.6%: the rule is an approximation, not an exact conversion.

Should I use historical or parametric (normal) VaR?

Historical VaR uses the portfolio's own returns and assumes nothing about their shape; parametric VaR assumes a normal distribution. At 95% they are often close, as on the demo (−1.87% against about −1.86%). The gap tends to open further out in the tail, which is where the normal assumption is weakest.

Launch offer The paid plan, free for three months on accounts opened until 31 Dec 2026. No card, no automatic charge.

Next guide

An explanation, not investment advice. Past performance does not predict future returns.