Leveraged ETF Returns Simulator

Coursera, Data Science, Developing Data Products, Course Project

Patrick Charles
interval software engineering

Leveraged ETFs - Intro

Background

  • ETF - exchanged traded funds
  • Leverage - derivatives and debt to magnify returns of an underlying index
  • Funds typically target multipliers of 2x or 3x to amplify daily returns
  • Long-term performance of leveraged ETFs is not well understood
  • Over time, compounding effects and price decay due to volatility

Goal

  • Simulate different scenarios to help undestand the effects of leverage on fund performance, utilizing R and Rmd for reproducible data processing and analysis.
  • Allow users to interact with and visualize the long-term effect on performance of different leverage multipliers, utilizing Shiny.

Leveraged ETF - Underlying Index

plot of chunk load_index

  # calculate daily leveraged returns
  for(i in 2:nrow(df.daily)) { 
    previous <- df.daily[i - 1, ]$Simulated # previous value
    delta <- df.daily[i, ]$Delta # closing price delta
    df.daily[i, ]$Simulated = # calculated, next leveraged price
    previous + previous * delta * leverage
  }

Leveraged ETF - Simulation

R can be used to simulate leveraged daily returns

  • by calculating price percent deltas based on historical closing prices
  • applying the deltas (with leverage) to simulate daily ETF returns
  • visualize cumulative leveraged vs. underlying (non-leveraged) returns over time

plot of chunk render

Leveraged ETF - Interactive Simulation

As a Shiny Application..

  • Allows a user to...
    • Select from a variety of underlying securities
    • Load historical data for a date range of interest
    • Interactively modify the ETF leverage multipliers
    • Instantly see the simulated performance of leveraged vs. non-leveraged funds

Try It!

The Source Code