Number of Trading Days per Year

In option pricing, volatility modeling, and quantitative finance in general, you often need the number of trading days per year as a parameter for your model. Which number to choose?

Trading Days per Year in US Markets

How many trading days per year are there in the US stock and option markets?

The short answer is 252.

To be precise, the average number of trading days per year from 1990 to 2018 has been 251.86. But we usually want to use an integer, so 252 is best.

This is the number of trading days in every year from 1990 to 2018, based on historical data of the VIX index:

1990   253
1991   252
1992   254
1993   253
1994   252
1995   252
1996   254
1997   251
1998   252
1999   252
2000   252
2001   248   (closed 4 days extra due to 9/11)
2002   252
2003   252
2004   252
2005   252
2006   251
2007   251
2008   253
2009   252
2010   252
2011   252
2012   250   (closed 2 days extra due to Hurricane Sandy)
2013   252
2014   252
2015   252
2016   252
2017   251
2018   251

Trading Days per Year in Other Markets

The number of trading days can be quite different in other markets and other countries.

The US has the advantage that most holidays, except the major ones like July 4 or Christmas, fall on the same day of week (usually Monday) every year. This makes the number of trading days more stable across years.

Some countries don’t do this and as a result, the number of trading days can fluctuate a bit more.

Calculating Number of Trading Days from Historical Data

You can easily calculate the number of trading days per year for your market, using daily historical data of some security or index which you are sure to have been trading every trading day in the period you want to use as reference.

A local broad market stock index is the best candidate, as that is certainly calculated every day the exchange is open. In the US, that would be an index like S&P500 or DJIA, or the VIX if you are interested in options. Another advantage of these indices is that their daily historical data is widely available (from the exchange or index provider directly or, for example, from Yahoo Finance).

Once you have the data, you only need to count the number of days for your period (number of rows with daily data) and divide the sum by the number of years it covers.

Avoid These Common Mistakes

1) Make sure your data is complete without gaps.

2) Make sure there are no duplicates. These may result from a technical error on the data provider’s end (writing a day’s data twice), or there can be various notes in some rows. In other words, clean the data before use.

3) Make sure the first and last year you include in your calculation have data from the very start of the year (typically the first trading day is 2 or 3 or 4 of January) to the very end (end of December). Don’t use the last year you have, which is most likely incomplete and would distort the result downwards.

4) Count the number of days using a function like COUNT in Excel. Do not subtract the first date from the last date, as that would defeat the purpose of the calculation – your number would include all calendar days, not just trading days.

5) When counting the number of years (to divide the number of days by it), do not just subtract the last year from the first year. For example, if you are using years 2015, 2016, 2017, 2018, you have 4 years. 2018 minus 2015 is 3. The correct formula is last year minus first year plus 1, or in our case 2018 – 2015 + 1 = 4 years. It is obvious with a small number of years, but when you have 38 years, this error is easy to overlook.

If you know Pivot Tables, use them. They make this task easier than plain Excel, and less prone to errors.

Calculating Number of Trading Days in SQL

It is even better to have historical data stored in a database, which makes cleaning data and avoiding duplicates easier, and calculate average number of trading days per year directly in SQL. For example:

SELECT 
    COUNT(td) / (YEAR(MAX(td)) - YEAR(MIN(td)) + 1)
FROM ind_d 
    WHERE symbol = '$VIX'
    AND is_main = 1 
    AND td < '2019-01-01'
;

The above query follows the logic explained earlier: count rows and divide by number of years, using the formula last year minus first year plus 1. The result in this case (using VIX index data 1990-2018) is 251.8621.

Alternatively, you can calculate the number of years using COUNT and DISTINCT; this query gives the same result as the previous one:

SELECT 
    COUNT(td) / COUNT(DISTINCT YEAR(td))
FROM ind_d 
    WHERE symbol = '$VIX'
    AND is_main = 1 
    AND td < '2019-01-01'
;

The is_main = 1 condition is specific to my database; I have multiple series for the VIX index from different sources, and this is to use the main series.

The td < '2019-01-01' condition is to exclude year 2019, as I am running this query in July 2019 and the data for year 2019 is incomplete (error #3 in the above error list). I am sure the data starts on 2 January 1990, so don’t need to include a similar condition for the first year (you may need to if your first year is incomplete).

Number of Trading Days by Year in SQL

To generate an overview of number of trading days in each year, like the table on the top of this page, you can use GROUP BY to group the dates by year:

SELECT 
    YEAR(td) AS yyyy, 
    COUNT(td) AS trading_days 
FROM ind_d 
    WHERE symbol = '$VIX'
    AND is_main = 1 
    AND td < '2019-01-01'
GROUP BY yyyy 
ORDER BY yyyy ASC;

You can also calculate the average number of trading days for the entire period by selecting AVG of trading_days from the above select. This query will give the same result as before, 251.8621:

SELECT AVG(trading_days) 
FROM (
    SELECT 
        YEAR(td) AS yyyy, 
        COUNT(td) AS trading_days 
    FROM ind_d 
        WHERE symbol = '$VIX'
        AND is_main = 1 
        AND td < '2019-01-01'
    GROUP BY yyyy 
    ORDER BY yyyy ASC
) AS years;

Note that in different database systems, some functions may have different names or not be available at all; these examples use MySQL/MariaDB. If your database system doesn’t support these functions, you can export the data and use a programming language like Python to do the calculations.