Giter VIP home page Giter VIP logo

volatilitydecomposition's Introduction

Volatility Decomposition

Asset prices are usually modeled as a continuous diffusion process with random jumps. By decomposing an asset's price variance into continuous and jump components, better risk management and asset allocation for a portfolio can be achieved.

In order to compute price variations, returns are first calculated and normalized by taking the logarithm of price S and S-1:

Log Returns

By recording a price time series at short time intervals (minute intervals used), the variation of an asset's price is measured by looking at the sums of products of returns calculated over very small time periods, also known as Quadratic Variation:

QV

Realized variation (RV) is the also the sum of squared returns, which yields a similar measure of price variation:

RV

As referenced in Barndorff-Nielsen(2004), Bipower Variation (BV) is the sum of the product of absolute time series returns:

BV

BV differs from RV in that as sampling frequency increases, price jumps will not affect BV since at least one of the returns will will shrink to zero as the sampling interval shrinks to zero.

The implication from this fact about BV is that the jump component of variance can be measured non-parametrically by the difference between RV and BV, with the logarithm of RV and BV delivering more stable results (Huang, Tauchen (2005)).

By comparing the continuous variation (BV) to the jump variation (ln(RV) - ln(BV)), a better view of public vs. private information can also be established. An observation is that private information is incorporated into an asset's price gradually (continuous variance) as investors do not wish to reveal their trading decisions while public information is incorporated into an asset's price immediately (jump variation) as investors react to newly disclosed data.

This code builds from several papers:

The code is also my personal code used in an academic paper I am currently co-authoring with one of my university professors in which we study the jump and continuous variances for all stocks within the S&P 500 index and analyze the effects these variables have on other firm characteristics.

Included are a few example minute price data sets for different companies to run the continuous and jump variance decomposition on. Each data set has about five days worth of minute prices and volumes.

Getting Started

To get started simply download the module and run Main.py in a terminal. Then input a stock ticker from the list of provided symbols to decompose volatility for that stock's minute prices, output CSV data files will appear in 'Volatility Data/'.

Example

If you have a CSV file of minute prices for a company, then just use the DailyVolDecomposition.py script and change the path variable to point to your CSV file. The script will decompose volatility for an arbitrary amount of days but make sure your CSV file is in the style of the supplied minute data CSV files with the same column headers.

Prerequisites

This module utilizes Numpy and Pandas for array and matrix manipulation and BeautifulSoup for HTML parsing, please install them using your preferred package manager before using this module.

Built With

License

This project is licensed under the MIT License - see the LICENSE file for details

volatilitydecomposition's People

Contributors

dlarsen5 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.