Harbourfront Technologies
  • Home
  • Articles
  • News
  • About
  • Home
  • Articles
  • News
  • About
Derivative Valuation, Risk Management, Volatility Trading
Picture

What is Stock Beta and How to Calculate Stock Beta in Python

3/31/2020

0 Comments

 

In finance, beta measures a stock's volatility with respect to the overall market. It is used in many areas of financial analysis and investment, for example in the calculation of the Weighted Average Cost of Capital, in the Capital Asset Pricing Model and market-neutral trading.

Beta of an investment is a measure of the risk arising from exposure to general market movements as opposed to idiosyncratic factors.

The market portfolio of all investable assets has a beta of exactly 1. A beta below 1 can indicate either an investment with lower volatility than the market, or a volatile investment whose price movements are not highly correlated with the market. An example of the first is a treasury bill: the price does not fluctuate significantly, so it has a low beta. An example of the second is gold. The price of gold fluctuates significantly, but not in the same direction or at the same time as the market.

A beta greater than 1 generally means that the asset both is volatile and tends to move up and down with the market. An example is a stock in a big technology company. Negative betas are possible for investments that tend to go down when the market goes up, and vice versa. There are few fundamental investments with consistent and significant negative betas, but some derivatives like put options can have large negative betas. Read more

In this post, we present a concrete example of calculating the beta of Facebook, a technology stock. As for the market benchmark, we utilize SPY.

The beta of a financial instrument is calculated as follows,

Quantitative analysis of stock beta

where

  • rS is the stock return,
  • rM is the market return,
  • Cov denotes the return covariance and,
  • Var denotes the return variance.

We downloaded 5 years of data from Yahoo Finance and implemented equation (1) in Python.  The picture below shows the result returned by the Python program

How to calculate stock beta

It’s observed that the beta of Facebook is 1.19, which means that Facebook is more volatile than the market.

The next picture shows the stock returns regressed against market returns. Note that the slope of the linear regression line equals the beta of the stock.

Quantitative trading using beta in python

Follow the link below to download the Python program.

Article Source Here: What is Stock Beta and How to Calculate Stock Beta in Python



0 Comments

Correlation Between the VVIX and VIX indices

3/25/2020

0 Comments

 

The VIX index is an important market indicator that everyone is watching. VVIX, on the other hand, receives less attention. In this post, we are going to take a look at the relationship between the VIX and VVIX indices.

While the VIX index measures the volatility risks, VVIX measures the volatility-of-volatility risks. Its calculation methodology is similar to the VIX’s except that instead of using SPX options it uses VIX options.

To study the relationship between these 2 indices, we first calculated the rolling 20-days correlation of the VIX and VVIX returns from January 2007 to March 2020. The median value of correlation is 0.807 and 25% quantile is 0.66

The figure below presents the rolling 20-days VIX/VVIX correlation for the last 2 years. We also superimposed SPY on the chart. We observe that the correlation is usually high but there are periods where it decreases significantly. The current period is one of those.

[caption id="attachment_393" align="alignnone" width="628"]Correlation Between the VVIX and VIX indices Correlation between the VVIX and VIX indices[/caption]

The next figure shows the scatter plot of VVIX returns vs. VIX returns. It’s observed that there is a significant population where VIX and VVIX returns are of opposite signs.  We subsequently calculated the number of instances where VIX and VVIX move in the opposite direction. This indeed happens 22% of the time.

[caption id="attachment_394" align="aligncenter" width="563"]VVIX returns vs. VIX returns VVIX returns vs. VIX returns[/caption]

Some implications of this study are:

  • Although the correlation between VIX and VVIX appears to be high, there is a significant number of instances where VIX and VVIX move in the opposite direction. So it’s fair to say that VVIX follows separate price dynamics which is different from the VIX. In other words, VVIX prices in different risks.
  • Long VIX options or SPX back spreads are not always a good hedge for an equity portfolio. The hedge can break down.
  • At times it’s cheaper to hedge a long equity portfolio using SPX options; at times it’s cheaper using VIX options.

See More Here: Correlation Between the VVIX and VIX indices



0 Comments

Value At Risk Financial Risk Management in Python

3/16/2020

0 Comments

 

Value at Risk (VaR) is a tool for measuring a portfolio’s risk.

Value at risk (VaR) is a measure of the risk of loss for investments. It estimates how much a set of investments might lose (with a given probability), given normal market conditions, in a set time period such as a day. ... For a given portfolio, time horizon, and probability p, the p VaR can be defined informally as the maximum possible loss during that time after we exclude all worse outcomes whose combined probability is at most p. This assumes mark-to-market pricing, and no trading in the portfolio.

For example, if a portfolio of stocks has a one-day 5% VaR of $1 million, that means that there is a 0.05 probability that the portfolio will fall in value by more than $1 million over a one-day period if there is no trading. Informally, a loss of $1 million or more on this portfolio is expected on 1 day out of 20 days (because of 5% probability). Read more

There are basically 3 methods for calculating the VaR [1]

  1. Historical simulation
  2. Variance-covariance approach
  3. Monte Carlo simulation

In this post, we implement the 3rd method, i.e. the Monte Carlo simulation, in Python.  More details of the methodology can be found in Ref [1].

The simulation parameters are as follows,

  • Portfolio value: $1 Million
  • Confidence interval: 95%
  • Time horizon: 1 day
  • Underlying: SPY

We utilize 5-years daily data of SPY retrieved from Yahoo Finance. The picture below shows the VaR retuned by the Python program.

Risk Management in Python, Value at Risk in Python

Note that the method presented in this post is suitable for calculating the VaR in a normal market condition. More advanced approaches such as Expected Tail Loss have been developed that can better take into account the tail risk.

Follow the link below to download the Python program.

References

[1] Hull, John C. (2003). Options, Futures, and Other Derivatives. Prentice-Hall

Originally Published Here: Value At Risk – Financial Risk Management in Python



0 Comments

    Archives

    April 2023
    March 2023
    February 2023
    January 2023
    December 2022
    November 2022
    October 2022
    September 2022
    August 2022
    July 2022
    June 2022
    May 2022
    April 2022
    March 2022
    February 2022
    January 2022
    December 2021
    November 2021
    October 2021
    September 2021
    August 2021
    July 2021
    June 2021
    May 2021
    April 2021
    March 2021
    February 2021
    January 2021
    December 2020
    November 2020
    October 2020
    September 2020
    August 2020
    July 2020
    June 2020
    May 2020
    April 2020
    March 2020
    February 2020
    January 2020
    December 2019
    November 2019
    September 2019
    August 2019
    April 2019
    March 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    June 2017

    RSS Feed

Powered by Create your own unique website with customizable templates.