## Problem Formulation

In this investment analysis, we explore three scenarios to compare how leveraging impacts the growth of an initial $10,000 investment over a period of 10 years.

- The first scenario demonstrates simple growth at a rate of 30% per year without leverage.
- In the second scenario, we introduce a one-time 50% margin loan reinvested into the asset, with loan costs at 7% annually, showing a more pronounced growth due to increased initial capital.
- The third and most dynamic scenario applies continuous re-leveraging each year, recalculating leverage based on the asset’s increased value, thereby exponentially boosting the investment’s growth potential. This method reflects not only the highest return but also illustrates the increasing risk associated with continuous borrowing.

By visualizing these scenarios, we clearly see the potential gains from leverage and the exponential increase in asset value, particularly in the aggressive re-leveraging approach.

π‘ **Note**: The third scenario provides the most gains when the investment works out. But it is path-dependent, meaning that if at any time the asset goes down by 50% or more (even for a short period of time), the margin call can completely wipe out the strategy.

## Analysis

Here is the comparison of the three investment scenarios, each starting with an initial investment of $10,000 over a span of 10 years:

The attached chart visually compares these investment values over the years, showing the exponential increase particularly in Scenario 3 due to the compounding effect of continual re-leveraging.

Year | Scenario 1: No Leverage | Scenario 2: One-time Leverage | Scenario 3: Re-leverage Each Year |
---|---|---|---|

0 | 10,000 | 10,000 | 10,000 |

1 | 13,000 | 14,150 | 14,150 |

2 | 16,900 | 19,626 | 20,637 |

3 | 21,970 | 26,830 | 30,401 |

4 | 28,561 | 36,288 | 44,930 |

5 | 37,129 | 48,681 | 66,469 |

6 | 48,268 | 64,898 | 98,366 |

7 | 62,749 | 86,094 | 145,584 |

8 | 81,573 | 113,769 | 215,476 |

9 | 106,045 | 149,875 | 318,925 |

10 | 137,858 | 196,952 | 472,039 |

**Scenario 1** shows straightforward growth without leveraging, resulting in a final investment value of $137,858 after 10 years.

The compound annual growth rate is 30%:

**Scenario 2** involves taking an initial 50% margin loan and reinvesting it into the asset. The total investment grows to $196,952, accounting for the cost of the loan.

The compound annual growth rate is 34.72%:

**Scenario 3** is the most aggressive strategy where leverage is recalculated and reapplied each year, reflecting the increase in asset value and allowing for exponential growth. This strategy results in a significantly higher value of $472,039 after 10 years, though it also carries higher risk due to increasing leverage.

The compound annual growth rate is 47.03%:

## Python Script

Here’s the Python code you can use to simulate and compare the three investment scenarios. This code calculates the growth of an initial investment under different leverage and reinvestment conditions, and plots the results for visual comparison:

import numpy as np import matplotlib.pyplot as plt # Parameters initial_investment = 10000 growth_rate = 0.30 loan_interest_rate = 0.07 loan_ratio = 0.5 years = 10 # Scenario 1: Simple growth scenario_1 = np.array([initial_investment * (1 + growth_rate) ** year for year in range(years + 1)]) # Scenario 2: Initial margin loan and reinvestment loan_amount = initial_investment * loan_ratio total_investment_2 = initial_investment + loan_amount scenario_2 = np.array([total_investment_2 * (1 + growth_rate) ** year - loan_amount * (1 + loan_interest_rate) ** year for year in range(years + 1)]) # Scenario 3: Re-leverage each year assets_3 = [initial_investment * (1+loan_ratio)] loans_3 = [initial_investment * loan_ratio] for year in range(years): # grow asset new_assets = assets_3[-1] * (1 + growth_rate) current_loan = loans_3[-1] * (1 + loan_interest_rate) new_loan = new_assets * loan_ratio - current_loan assets_3.append(new_assets + new_loan) loans_3.append(new_assets * loan_ratio) scenario_3 = np.array([asset - loan for asset, loan in zip(assets_3, loans_3)]) # Create a chart plt.figure(figsize=(12, 8)) plt.plot(range(years + 1), scenario_1, label='Scenario 1: No Leverage', marker='o') plt.plot(range(years + 1), scenario_2, label='Scenario 2: One-time Leverage', marker='o') plt.plot(range(years + 1), scenario_3, label='Scenario 3: Re-leverage Each Year', marker='o') plt.title('Comparison of Investment Scenarios') plt.xlabel('Years') plt.ylabel('Investment Value ($)') plt.legend() plt.grid(True) plt.show()

This code uses NumPy for array operations and matplotlib for plotting the growth of investments over time. Each scenario is defined based on the investment strategy:

**Scenario 1**represents a straightforward investment without leverage.**Scenario 2**incorporates a one-time margin loan.**Scenario 3**applies a re-leveraging strategy each year, dynamically adjusting the loan based on the asset’s performance.

You can run this script in any Python environment that supports these libraries to visualize and analyze the different investment scenarios.

Feel free to also read the following Finxter article:

π The Math of Becoming a Millionaire in 13 Years

While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.

To help students reach higher levels of Python success, he founded the programming education website Finxter.com that has taught exponential skills to millions of coders worldwide. He’s the author of the best-selling programming books Python One-Liners (NoStarch 2020), The Art of Clean Code (NoStarch 2022), and The Book of Dash (NoStarch 2022). Chris also coauthored the Coffee Break Python series of self-published books. He’s a computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.

His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.