Duplicating Leverage ETFs

A Comprehensive Approach to Calculation

Introduction

In the world of finance, leverage is a powerful tool that allows investors to amplify their returns by using borrowed capital. However, calculating leveraged data can be a complex task, involving various factors such as fees, interest rates, and crash protection mechanisms. In this article, we will walk you through our comprehensive approach to calculating leveraged data, accompanied by code snippets to illustrate the process. We will also discuss how we replicate a wide range of leverage levels, from -5x to +5x, using a non-leveraged ETF or stock ticker.


Custom Leverage Selection

We offer a range of leverage options: -5x, -4x, -3x, -2x, -1.5x, 1.5x, 2x, 3x, 4x, and 5x. Each 'x' number represents a common leverage option applied to ETFs both domestically and internationally. For example, 1.5x leverage means a 150% return on the daily percentage return of the underlying ETF such that an ETF that increases by 10% in a day will yield a 15% return with 1.5x leverage or a 30% return with 3x leverage. Negative leverage means the ETF will yield positive returns when its value falls for the day. If an ETF decreases by -10% in a day, an investment with -1.5x leverage will yield a 15% return.

Think of negative leverage as betting that the ETF will decline and profiting from that drop, while positive leverage implies betting that the ETF will rise, resulting in profit from its appreciation.


Note: QQQ a NASDAQ-100 ETF and TQQQ the 3X version of QQQ. SPY is a SP500 ETF and UPRO a 3x leveraged version.

10yr compare with perfect leverage
This is our base line, 3x leverage applied to QQQ and SPY. Note how the calculated leverage is much higher then the real leveraged fund

10yr compare with perfect leverage
This is our base line, note how much higher the perfect leverage replication appears


Custom Fee Percentage

One of the key aspects of our leveraged data calculation is the custom fee percentage. We have set a default fee of 1%, which is a common ETF fee for leveraged ETF’s. We apply that fee spread out over 250 trading days. This fee is applied in our calculations when a fee percentage is entered. You can also adjust this fee percentage if you want to simulate a higher borrow cost over any number of years!


10yr compare with perfect leverage with fee
Now we added 1% fee, 3x leverage applied to QQQ and SPY

10yr compare with perfect leverage
Closing the gap

Applying Yearly Fed Fund Rates

To ensure accuracy in our calculations, we incorporate historical Fed Fund Rates going back to 1955. These rates are sourced directly from the Federal Reserve at https://www.federalreserve.gov/DataDownload/default.htm and are averaged by year. We apply that rate distributed over 250 trading days. By incorporating these rates into our calculations, we can account for the impact of interest rates on leveraged investments over time. In the future we will move to monthly averages instead of yearly but there are other more pressing items to fix at this time.


Calculating Borrowing Costs

When calculating borrowing costs, we take into account that a 1x investment has no borrowing involved. However any leverage above 1x has 1x subtracted from the total leverage amount. Therefore, if we consider a 3x leveraged investment, the borrowing rate would be 2x. This concept is applied throughout our calculations to determine the accurate borrowing costs for different leverage levels. The Fed Fund Rate is then applied to this X multiple.


Internal Lending Costs

In addition to the custom fee percentage, we also account for internal lending costs, which are set at a hard-coded 0.8%. These costs represent additional charges that banks and other financial institutions impose on borrowers, such as service fees and other administrative costs. Note below from the ProShares Report that while the Fed Fund Rate is 3.78%, the borrowing cost for that time period ranged from 4.30% to 4.70%. This hard-coded 0.8% is meant to account for this discrepancy.

  • Fed Fund Rates Nov, 2022 Prime Rate 6.95% / Fed Fund Rate 3.78%
  • Proshares Report: TQQQ Nov 30, 2022: Rate Paid to Banks 4.43% to 4.68%
  • Proshares Report: UPRO Nov 30, 2022: Rate Paid to Banks 4.33% to 4.49%
  • Click for Report: ProShares Semi-Annual Report

10yr compare with perfect leverage with fee
Now we added 1% fee and borrowing costs, 3x leverage applied to QQQ and SPY

10yr compare with perfect leverage
Almost a perfect match


Fed Crash Protection

Our calculation method also incorporates a Fed Market Crash Protection mechanism, which is designed to limit potential losses in the event of a severe market downturn. This mechanism is applied to our calculations to ensure that our leveraged data remains as accurate and realistic as possible during periods of extreme market volatility. Note indexes have Fed Market Protections applied to them, these protections are new and when back testing leveraged ETFs we want to account for how this protection would have helped in the past. The underlining ticker is allowed to drop no more than -20% a day, then the leverage and fees are applied to this adjustment.


Code Implementation

The code snippet provided demonstrates our comprehensive approach to calculating leveraged data. The `calculateLendingFee` function calculates the lending fee based on the current Fed Fund Rate and the leverage level. The `applyLeverage` function takes into account various factors, such as fees, crash protection, and Fed Fund Rates, to generate leveraged data that closely resembles the true leveraged ETF we are replicating.


function calculateLendingFee(fedFundRatesData, leverage) {
    const currentYear = new Date().getFullYear();
    const currentFedFundRateData = fedFundRatesData.find(item => item.year === currentYear);
    const currentFedFundRate = currentFedFundRateData ? currentFedFundRateData.rate : 0;
    const lendingFee = currentFedFundRate * (leverage - 1);
    return lendingFee;
}


    
    function applyLeverage(stockData, leverage, fee, crashProtection, getFedFundRateByYear, applyFedFundRate) {
            const leveragedData = JSON.parse(JSON.stringify(stockData));
            const unmodifiedClosingPrices = stockData.map((data) => data.y);
            const totalFee = fee + 0.8;
            const dailyFeeMultiplier = 1 - (totalFee / 100 / 250);
            for (let i = 1; i < leveragedData.length; i++) {
                const currentDate = new Date(leveragedData[i].x);
                const previousDate = new Date(leveragedData[i - 1].x);
                const currentYear = currentDate.getFullYear();
                const fedFundRate = applyFedFundRate ? getFedFundRateByYear(currentYear) : 0;
                const dailyFedFundRateMultiplier = fedFundRate ? 1 - ((fedFundRate / 100 / 250) * (leverage - 1)) : 1;
                const dailyReturn = (leveragedData[i].y / unmodifiedClosingPrices[i - 1]);
                const dailyRetunLeveraged = dailyReturn - 1;
                const leverageFactor = leverage;
                const adjustedDailyReturn = dailyRetunLeveraged * leverageFactor;
                let protectedDailyReturn = adjustedDailyReturn;
                if (crashProtection && adjustedDailyReturn < -0.2) {
                    protectedDailyReturn = -0.2;
                }
                const newValue = leveragedData[i - 1].y * (1 + protectedDailyReturn) * dailyFeeMultiplier * dailyFedFundRateMultiplier;
                leveragedData[i].y = newValue;
            }
            return leveragedData;
        }
    
    


2yr compare with perfect leverage with fee
You can see over a 2yr period the lines disappear

2yr compare with perfect leverage
Almost a perfect match, including min and max investment amounts

Below is our matching percentage of calculated replications to the real leveraged ETFs. We also anticipate our percentages to get even better once we move to monthly Fed Fund Rates averages instead of yearly averages.

10yr Leverage Replication Compare:
  • UPRO vs SPY-3x: 96.5%
  • TQQQ vs QQQ-3x: 98.7%
2yr Leverage Replication Compare:
  • UPRO vs SPY-3x: 98.2%
  • TQQQ vs QQQ-3x: 99.0%

Conclusion

By incorporating custom fees, historical Fed Fund Rates, borrowing costs, internal lending costs, and crash protection mechanisms into our calculations, we are able to achieve a 96.5% to 99% match over 10 years to the true leveraged funds we are replicating. This comprehensive approach ensures that our leveraged data is as accurate and reliable as possible, providing investors with a valuable tool for making informed decisions in the world of leveraged investments.


Disclaimer

Please note that the content provided on this website, and in this blog, is for informational purposes only. It does not constitute investment advice. You should not make any investment decisions based solely on what you read here. It's important to do your own research and consult with a qualified financial advisor before making any investment decisions. We are not responsible for any decisions made based on the information provided in this blog.

Investing involves risk, including the potential loss of principal. Financial markets are volatile and can fluctuate significantly in response to company, industry, political, regulatory, market, or economic developments. It's crucial to maintain a diversified portfolio and make informed decisions based on your individual financial circumstances and investment goals.

We strongly recommend reading a variety of books and resources to gain different perspectives on investing. Remember, education is a key component of successful investing.