How Do You Calculate Volatility In Excel?

by AdamHGrimes

I received a question from a reader who asked, “Can you calculate volatility in Excel?” The answer is, yes you can, but there are a few things you need to know. Without going into too much detail here, there are many ways to calculate volatility. Two of the most common measures are implied and historical (also called realized or statistical) volatility. It is fairly simple to calculate historical volatility in excel, and I will show you how in this post. Calculating implied is quite a bit more complicated. You technically can do it in excel, but you have to impute it from an option price. In addition, there’s actually a volatility surface, or different values of implieds for different strike prices and maturities. That’s a topic for another day; today let’s just look at how to calculate a simple historical volatility in Excel.

有位读者问我“能用Excel计算历史波动率吗?”答案是可以,当然没问题,但有几件事需要了解一下。计算波动率的方法有很多,在此不一一赘述。波动率中最主要的是隐含波动率和历史波动率,历史波动率也被称为实际波动率或统计波动率。今天我们要做的就是探究如何用Excel计算历史波动率。用Excel计算历史波动率很简单,本文将展示如何来做。隐含波动率的计算过程有点复杂。理论上也可以在Excel上算出来,但必须通过期权的价格进行推算。此外,实际上还有波动率曲面的存在,也就是按照不同的期权行权价和不同的期限展示出来的隐含波动率水平。但那是另一个话题,今天我们要探讨的就是如何用Excel计算比较简单的历史波动率。

1.Collect your raw data, in the form of a closing price for each time period. Many people do not know, but Yahoo Finance is a good source of daily data that can be downloaded into a spreadsheet.Your data will likely include other data points such as high, low, volume, etc, but just ignore everything except the close.

准备工作:搜集每一个统计时点的收盘价原始数据。很多人不知道雅虎财经网站是个非常好的电子表格数据下载来源。数据中可能还包括最高价,最低价,成交量等其他数据,但只留下收盘价,其他的均可放弃。

2. The first step is to convert the prices into a return series. Again, let’s not dig too deeply into the theory in this post, but prices are somewhat arbitrary. Is a $50 price a change a lot? Well, that depends on the price of the asset and how much prices usually change. Converting to returns is nothing more than changing the price series into a series of percentage changes. This is the first step in nearly all quantitative or mathematical market analysis. In Excel, start at the second price from the top in your series (assuming closing prices are in a column with the newest price at the bottom). In the cell to the  right of prices, divide the second price by the first and subtract one, as in the pic. Copy this formula down the entire column.

数据加工第一步:

根据收盘价计算出一系列回报率数据。本文不会过多的探讨理论知识,但成交价多少有些随机性,偶然性。50美元的涨跌幅度算是很大的变化吗?这得看资产价格的绝对值大小以及通常的价格变动幅度。将收盘价转换成回报率只不过是将一系列的成交价转换成一系列的百分比波幅。这是几乎所有量化或以数理统计为基础的市场分析的第一步。假设在Excel表中成交价数据是按从上到下的顺序排列的,先从第二个成交价开始,在第二个成交价右边的数列中用第二个成交价除以第一个成交价,再减去1,然后把公式下拉复制一直到最后一个成交价所在的位置为止。见下图,

3. Next, find the standard deviation of the returns. The  formula for standard deviation in Excel is =STDEV(…), and takes a range of prices as an input. In the graphic, I have calculated a 10 day standard deviation of prices, but that is for the illustration only. Set your window to whatever time period you want to evaluate, and, again, copy the formula down. Twenty days is a good starting point if you haven’t done this analysis before.

数据加工第二步:

计算一系列回报率的标准差。Excel中标准差计算公式为=STDEV(…),需要先确定一个计算周期,我在下图中选择以10天作为标准差计算周期,但仅限于演示说明。在第10个回报率数字的右侧栏中用标准差公式算出这10天的标准差,同理下拉复制到最后一个成交价所在位置。如果以前没做过此类分析,将20天作为计算周期是个不错的选择。

4. So far, the procedure has been straightforward: calculate a return series, and then calculate the standard deviation of that series. There is one more step, which is perhaps the only part of this that is conceptually a little bit complicated. You have calculated the standard deviation of the returns for whatever the time interval of your data is.  If you have daily data, you have calculated a daily standard deviation, and so on for hourly, weekly or any period. Historical volatility is the annualized standard deviation of returns. We must multiple the standard deviation by an annualization factor, which is the square root of how ever many of your periods are in a year. This example is daily data; there are 262 trading days in a year, so we multiply the standard deviation by SQRT(262). If you are using weekly data, the annualization factor is SQRT(52), etc.

但目前为止,计算过程清晰又直白:先计算回报率,再计算标准差。下面还有一个步骤,可能只是在这步会遇到比较复杂的概念。截至目前为止,已经得出回报率的标准差,不管选择的周期天数是多少。如果用的是每日成交价数据,算出来的就是日均标准差,同理,用的是什么周期的数据,得出的就是什么周期的标准差,以此类推。历史波动率是回报率的年化标准差,因此我们必须用计算出来的标准差乘上年化因子,也就是所选择的数据周期在一年内有多少个周期这个数据的平方根。以日均数据为例,假设一年有262个交易日,那么我们就会用=SQRT(262)计算出年化因子,然后乘以日均标准差。如果数据周期是一周,那么年化因子等于SQRT(52),以此类推。

This is one example, but a slightly more complex example, with graphs, can be found step by step on the tabs in this spreadsheet. We will consider exactly what this measure of volatility is, what it does, what we can do with it, and, even more importantly, what’s wrong with it in a future post.

这个例子难度有点大,每一步骤后面都附有图表。以后我们会探讨波动率究竟是什么,能起什么作用,我们能用来做点啥,以及最重要的,它有哪些缺陷。

Edit: This sheet and article use an annualization factor of 262. There is some debate over what number to use here, but you’ll see it doesn’t really make much of a difference. 252 is probably the most accurate number (and is what I use in my calculations now), but, as long as you’re consistent in your calculations, the actual number doesn’t really matter.

附加说明:本文中年化因子是用262交易日算出来的,有些人对此有异议,但差别真的不大。更准确的数字应该是一年有252交易日,但不管是多少,只要在计算过程中一直用下去,实际结果不会有大的区别。

译者注:按照操作步骤,以追踪标准普尔500指数走势的交易所交易基金SPY为例,计算一下SPY的历史波动率。

第一步,原始数据。SPY收盘价的下载网址为https://finance.yahoo.com/quote/SPY/history?period1=1505360042&period2=1536896042&interval=1d&filter=history&frequency=1d,最左边的红线标注出处为数据的期限,打开下拉式菜单可选择起始日期;中间偏右的红线标注出处为数据的频率,下拉式菜单的选项包括每日,周度和月度;最右的红线标注出处为下载功能键,点击后即可下载成Excel格式。

第二步,原始数据筛选。

下载后,原始数据格式如下

去掉开盘价,最高价,最低价,成交量等没用的数据,只留下经调整后的收盘价

第三步,计算回报率。

数据筛选完成,A列为从旧到新的日期排列,B列为经调整后的收盘价,C列为回报率。例如,在C3栏计算8月14日收盘价比前一交易日的同比波幅

结果为283.899994/282.100006-1=0.64%

光标按住C3,并下拉该公式至最新日期2018-9-13成交价处,得出最近一个月SPY的回报率

第四步,计算回报率的标准差。

标准差公式为=stdev(),我在这里选择计算每5天的标准差,因此()内的数据范围为C3至C7,标准差数据所在栏为D7

结果显示2018-8-14至2018-8-20这5个交易日SPY的回报率为0.61%

光标按住D7,并下拉该公式至最新日期2018-9-13的成交价处,得出最近一个月SPY的标准差

第四步,标准差的年化处理。

假设一年有252个交易日,年化因子的公式为=SQRT(252),结果所在栏为E7

最终结果:2018-8-13至2018-9-13期间SPY的5日日均历史波动率

matlab 历史波动率,如何用Excel统计历史波动率相关推荐

  1. 计算机品牌调查表excel,如何用excel统计的调查问卷

    如何用excel统计的调查问卷 如何用excel统计的调查问卷 有些人可能经常要对调查问卷进行统计,使用手写的方法(就是在纸上写正字的方法)虽然很方便,不过不方便在一定条件下进行统计,如在男士的条件下 ...

  2. matlab筛选excel数据统计,#excel筛选数据#如何用excel表格中的数据制图

    如何将excel中的部分数据做成图表 数据透视表岂不更简单??? Excel表格作图中X轴的刻度怎么设置? 图表当中的X轴刻度也就是横坐(在2003版本里面叫分类轴)的刻度. 选图表X轴--右键--设 ...

  3. 用matlab处理表格,matlab删除excel表格数据-如何用matlab处理多个excel表格中的数据...

    如何用matlab处理多个excel表格中的数据 biao='D:\Program Files\matlab\bin\filename.xls'; A1=xlsread (biao,'Sheet1', ...

  4. matlab批量导入excel表格数据,matlab导入excel表格数据-如何用matlab读取多个excel表格数据,将每个表格数......

    如何用matlab读取多个excel表格数据,将每个表格数... 一xlsread()函数,比import简单的多,具体语句:A = xlsread('yourfilename.xls')望高手支招! ...

  5. html制作统计期末成绩,如何用Excel制作学生成绩统计表

    如何用Excel制作学生成绩统计表 发布者:张敏     所属单位:达川区亭子镇中心小学     发布时间:2016-07-05    浏览数:0 每一学期结束时,教师都要统计学生的成绩,在电脑逐步普 ...

  6. 利用matlab处理表格数据,/如何用matlab处理多个excel表格中的数据

    excel最大可处理多少条数据 理论上可以处理59999条(行)数据 但是实际上同一个工作表中无法处理这么多数. Excel 怎样做一个客户多个数据的表 1.首先,简单描述问题,在如下的表格中想姓名一 ...

  7. 如何用matlab算导数曲线,excel 曲线求导_excel怎样对表格中数据进行求导

    怎样在两个EXCEL表中导数值 用VLOOKUP函数. 举例:看图片上的例子 =VLOOKUP(E2,A:B,2,0) 这个公式的含义是,E2就是你说的表1上的名称这个单元格,A:B就是2表中的两列, ...

  8. matlab批量合并表格数据,用matlab合并excel表格数据-如何用matlab读取多个excel表格数据,将每个表格数......

    用matlab如何识别excel里的单元格是否为合并单元格 方法如下: 使用函数xlsread读取单个文件. num=xlsread(filename) filename是单引号括起来的带路径的文件名 ...

  9. matlab excel 排序,“如何用matlab处理多个excel表格中的数据“excel怎么排序

    请问如何在matlab gui界面中插入excel表格并可进行编辑 最简单的方法,gui界面上一个table控件,放置两个按钮. 按钮名字分别改为打开和保存,table的属性里,把columnname ...

最新文章

  1. Leetcode 391.完美矩形
  2. comsat java_java-com.thoughtworks.xstream.converters.ConversionExce...
  3. python处理excel大数据-当Excel遇到大数据问题,是时候用Python来拯救了
  4. 第四章4.1 4.2 快速傅里叶变换FFT-介绍
  5. 05丨数据同步:主从库如何实现数据一致
  6. Rplidar学习(五)—— rplidar使用cartographer_ros进行地图云生成
  7. android 复用标题栏,Android基础---使用ToolBar教你打造一个通用的标题栏
  8. 打印多页时两边取消留白_办公必备技巧:Word打印技巧大全
  9. 手把手带你入门Python爬虫(二、爬虫预备知识)
  10. 《Kotlin项目实战开发》 第3章 类型系统与可空类型
  11. 动态时间归整/规整/弯曲(Dynamic time warping,DTW)
  12. iOS数据库的使用(一):FMDB多线程
  13. wifi 小米pro 驱动 黑苹果_macOS安装教程兼小米Pro安装过程记录
  14. 定时任务时间表达式的规则
  15. 3DMAX程序贴图之3D木材贴图使用教程
  16. android 百度基站定位服务器,Android基站定位原理及实现代码
  17. 全国计算机一级考试题库及答案(2018)
  18. 前端HTML中防止用户在短时间内频繁多次点击按钮
  19. GitHub简介、fork、pull和clone、快速起步
  20. elasticsearch查询关键字slop

热门文章

  1. 核心单词Word List 41
  2. Mysql8创建用户以及赋权操作
  3. mysql创建用户并赋权(亲测)
  4. Wireshark抓包定位系统网页响应慢的问题
  5. box-shadow和颜色渐变
  6. 康永,给残酷社会的善意短信
  7. 算数运算符、算术表达式
  8. 【NOIP模拟】腐败
  9. GPS定位系统源码,通用系统源码包含GPS行业核心功能可轻松开发出各类行业应用
  10. myApps常用脚本API(一)