Close-to-Close Historical Volatility Calculation – Volatility Analysis in Python

Subscribe to newsletter

In a previous post, we touched upon a stock’s volatility through its beta. In this post, we are going to discuss historical volatilities of a stock in more details. If you want to use the online version, go to Historical Volatility Online Calculator.

Also referred to as statistical volatility, historical volatility gauges the fluctuations of underlying securities by measuring price changes over predetermined periods of time. It is the less prevalent metric compared to implied volatility because it isn’t forward-looking.

When there is a rise in historical volatility, a security’s price will also move more than normal. At this time, there is an expectation that something will or has changed. If the historical volatility is dropping, on the other hand, it means any uncertainty has been eliminated, so things return to the way they were. Read more

Subscribe to newsletter https://harbourfrontquant.substack.com/ Newsletter Covering Trading Strategies, Risk Management, Financial Derivatives, Career Perspectives, and More

There are various types of historical volatilities such as close-to-close, Parkinson, Garman-KIass, Yang-Zhang, etc. These volatility measures play an important role in trading and risk management. In this post, we will discuss the close-to-close historical volatility.

The close-to-close historical volatility (CCHV) is calculated as follows,

historical volatility in python

where xi are the logarithmic returns calculated based on the stock’s closing prices,  and N is the sample size.  In this example, N=22, the average number of trading days in a month.

We implemented the above equation in Python. We downloaded SPY data from Yahoo finance and calculated CCHV using the Python program. The picture below shows the close-to-close historical volatility of SPY from March 2015 to March 2020.

volatility trading in python

It’s observed that the volatility is a mean-reverting process. The CCHV has the following characteristics [1]

Advantages

  • It has well-understood sampling properties
  • It is easy to correct bias
  • It is easy to convert to a form involving typical daily moves

Disadvantages

  • It is a very inefficient use of data and converges very slowly


To download the accompanying Excel workbook or Python program for this post:
1. Subscribe to the newsletter. If you're already a subscriber, go to the next step
2. Once subscribed, wait for the next newsletter where you can find a link for referring a friend. Use that link to refer a friend or two
After completing these steps, you’ll gain access to the file for this post, along with files for a dozen other posts.


References

[1] E. Sinclair, Volatility Trading, John Wiley & Sons, 2008

Subscribe to newsletter https://harbourfrontquant.substack.com/ Newsletter Covering Trading Strategies, Risk Management, Financial Derivatives, Career Perspectives, and More

Further questions

What's your question? Ask it in the discussion forum

Have an answer to the questions below? Post it here or in the forum

LATEST NEWSCGTN: How China, Spain deepen ties amid global uncertainty
CGTN: How China, Spain deepen ties amid global uncertainty

CGTN explores Spanish Prime Minister Pedro Sanchez’s visit to China, emphasizing the role of sustained high-level exchanges as a key driver in strengthening China-Spain relations amid global uncertainty. The piece further examines expanding economic cooperation and shared commitments to multilateralism, stable global supply chains, and…

Stay up-to-date with the latest news - click here
LATEST NEWSToshiba Starts Sample Shipments of New “SmartMCD™” Series Product Integrating Microcontroller and Motor Driver
Toshiba Starts Sample Shipments of New “SmartMCD™” Series Product Integrating Microcontroller and Motor Driver

— Low-Speed Sensorless Control Technology for Three-Phase Brushless DC Motor Control — KAWASAKI, Japan — Toshiba Electronic Devices & Storage Corporation (“Toshiba”) has started to ship engineering samples of “ TB9M030FG,” the latest addition to its “SmartMCD™”[1] series of motor control devices. The new device…

Stay up-to-date with the latest news - click here
LATEST NEWSFlow Capital Announces 2025 Financial Results
Flow Capital Announces 2025 Financial Results

Total Revenue up 41% and Recurring Free Cash Flow up 79% TORONTO, April 15, 2026 (GLOBE NEWSWIRE) — Flow Capital Corp. (FW-V), a leading provider of flexible growth capital and alternative debt solutions, announces its financial and operating results for the fourth quarter and year…

Stay up-to-date with the latest news - click here
LATEST NEWSStarfighters Space, Inc. files Fiscal 2025 Annual Report
Starfighters Space, Inc. files Fiscal 2025 Annual Report

CAPE CANAVERAL, Fla. — Starfighters Space, Inc. (“Starfighters” or the “Company”) (NYSE American: FJET), the innovative aerospace company, owner and operator of the world’s largest fleet of commercial supersonic aircraft, is pleased to report, in accordance with NYSE American requirements, the filing of the Company’s…

Stay up-to-date with the latest news - click here
LATEST NEWSKalshi's not having a good time in Ohio
Kalshi's not having a good time in Ohio

The fine comes on the heels of a court loss Kalshi suffered in March, when a federal judge said its offerings should be considered gambling.

Stay up-to-date with the latest news - click here

Leave a Reply