How Developers Can Supercharge Their Savings
Tags: showdev, javascript, beginners, motivation
Published: 2020-07-30 06:49:39

Any type of financial investment should earn you compound interest. Over time, this will build the value of your investment passively.

[If you start investing,](https://ilonacodes.com/blog/top-5-best-ways-to-start-investing-for-developers/) you should learn how to develop an understanding of the passage of time that affects the value of a dollar that you have invested.

[![Your personal investment strategy](https://dev-to-uploads.s3.amazonaws.com/i/4yfhsd5tmzhbh0m7ou02.png)](https://ilonacodes.com/investor-profile/)

It means that the time value of money refers to the concept that invested money can earn interest and be worth more in the future than it is today.

>“Someone's sitting in the shade today because someone planted a tree a long time ago."—Warren Buffet

Assuming that the annual market rate of interest is 10%, the $100 deposit will earn 10% or $10 by the end of the year: $100 in 2020 is $110 in 2021.

[As a developer-investor,](https://ilonacodes.com/blog/why-developing-your-personal-investment-strategy-is-a-must/) you should always make decisions regarding cash flows and prepare a cash flow analysis that takes future cash flows into account before investing in any asset.

❗️ **Compute your investment’s present and future values before investing, because the present value is always less than the future value.**

This is true because money can earn simple and compound interest:

- **Simple Interest** is earned on the principal amount (the original amount of investment) only according to the above-listed example: $100 in 2020; $110 in 2021; $120 in 2022 => each year, the $100 investment will earn $10.

- **Compound Interest** is earned on the principal + interest earned in prior periods: $100 in 2020; $100 * 1.10 = $110 in 2021; $110 * 1.10 = $121 => the original $100 investment would increase more than $10 per year due to the compounding of interest.

What’s the difference in the investment balance that would be at the end of 10 years using both simple and compound interest?

![Simple and Compound interests](https://dev-to-uploads.s3.amazonaws.com/i/qild0y59jrshqm9woi9a.png)

**[🧮 Use my compound interest calculator here!](https://compound.ilonacodes.com/)**

Here is the main implementation algorithm of a simple compound interest calculator with JavaScript to easily compute the compound interest and total deposit future value of the investment in years, based on an initial principal:

```javascript
// this function will return a table with data for all next years
const calculate = ({ principal, years, interest }) => {
  const rate = interest / 100;
  // the first entry is year 0—makes the logic simpler below
  const table = [[0, principal, principal, 0]];

  for (let i = 1; i <= years; i++) {
    table.push([
      i,  // year number
      table[i - 1][1] + principal * rate,  // with simple interest
      table[i - 1][2] * (1 + rate),  // with compounding interest
      table[i - 1][2] * rate  // compounding dividends this year
    ]);
  }

  // remove convenience entry for year 0
  return table.slice(1);
};
```

>“Compound interest is the eighth wonder of the world. He who understands it, earns it … he who doesn’t … pays it."―Albert Einstein

## Importance of the compound interest for investors

If you want to learn how to put your money to work for you without much effort, learn first how compound interest works! It can help you exponentially grow your wealth because you are not only getting interest on your initial investment (principal), but you are getting interest on top of interest!

Let me illustrate how your money can make more money for you with examples:

### 🎓 Saving money for the college tuition for your child

Goal: Start saving at birth for 18 years.

_Question: How much do you have to save today for the investment to grow to $50000 at the end of 18 years with the 10% average interest rate?_

Formula: pv = fv / (1 + i) ^ n

Explanation:

1. You want to have a $50000 at the end of 18 years, so the fv (future value) is 50000

2. The number of periods is 18 years, n = 18

3. The interest rate is 10%, i = 0.1

4. You don’t know pv (present value), so it is unknown in our equation

**Solution: pv = $50000 / (1 + 0.1) ^ 18 = $8992.94**

👉 You need to invest $8992.94 today that pays 10% per year to have $50000 in 18 years.

___

If you wanted to invest on a monthly basis instead of a one-time lump sum, how much would you need monthly?

[![Top-15 Tips on How to Free Extra Cash For Investment](https://dev-to-uploads.s3.amazonaws.com/i/hyd67zkz9s8u804z89xf.png)](https://ilonacodes.com/financial-tips-for-freeing-extra-money-for-investment/)

### 🚘 Buy a car in X years

Goal: To save enough money to buy a $50000 car in 5 years.

_Question: How much do you have to invest each month to save $50000 in 5 years, with the current market interest rate of 7%?_

Formula: PMT = (FV * i) / (n x ((1 + i/n) ^ n x (t - 1))) (capital letters to indicate that is an annuity problem)

Explanation:

1. You want to save on an annual basis in order to have $50000 in 5 years. You have to calculate an FV (future value of an annuity)

2. The time is t = 5 years, and the number of times interest is compounded is monthly n = 12

3. The interest rate is 7%, i = 0.07

4. You don’t know PMT (the monthly payment you must pay to reach your goal in 5 years), so it is unknown in our equation.

**Solution: PMT = (50000 * 0.07) / (12 x ((1 + 0.07/12) ^ 12 x 5 - 1)) = $698.30**

👉 You need to pay $698,30 into your savings each month with the 7% of interest rate to buy a car for $50000 in 5 years.

___

### 🏦 Investing in bonds

Goal: investing in bonds long-term (more than a year).

Let’s assume you are considering an investment in bonds. Your broker suggests buying 200, 3-year, 6% XYZ Corporation bonds, which pay interest semi-annually.

You ask the broker for more clarification, which they gladly provide:

- these bonds have a face value of $50 and mature at the end of 3 years from the issuance date

- 6% is the contractual rate of interest, which you will receive

- these bonds pay interest semi-annually, so you will receive 3% interest every 6 months

What you know:

1. Bond investment = 200 bonds x $50 = $10000

2. Semi-annual interest payments = $10000 x 3% = $300 (you will get twice per year)

3. Contract rate of interest = 6% per year

4. Inflation rate = 2%

5. Maturity date = 3 years or 6 time periods

_Question: What is your investment’s present value, and how much money will you return in 3 years?_

To answer your question, you have to analyze the bond — make a bond valuation:

**Step 1: Calculate the pv (present value of a lump sum) of the bond face**

Formula: pv = fv / (1 + ir) ^ n — the equation present value equals future value times the factor, where “ir” is an inflation rate.

pv = $10000 / (1 + 0.02) ^ 3 = $9423.22 — the present value of the face of the bonds in 3 years.

**Step 2: Calculate the PV (Present Value of an annuity) of the periodic bond interest payments**

First, we need to calculate a semi-annual interest payments = $10000 x 3% = $300 (you will get twice per year)

PVIFA = (1 - (1 + i) ^ -n) / i => (1 - (1 + 0.03) ^ -6) / 0.03 = 5.42

This means that every $1 you receive is worth $5.42 in present value. Now you can work out the present value based on the payment amount that you are receiving semi-annually: PV = $300 * 5.42 = $1626

**Step 3: Add the results of Step 1 + Step 2 to calculate the bonds' value for 3 years:**

The present value of your money in 2022 is $9.423,22 + $1.626 = $11.049,22 influenced by the 2% of inflation rate along 3 years.

___

## 💬 Conclusion

One of the main tasks of financial managers is to use compounding interests to estimate the risk and return on investments and compare investment risks and return to analyze financial challenges and opportunities.

[To select which financial products are apt to invest for the long term,](https://ilonacodes.com/blog/why-developing-your-personal-investment-strategy-is-a-must/) there are some metrics that you, as an investor, need to understand. The power of compounding interests is one of them.

It is easier than it sounds, and you do not need to be a financial manager to do it. Just remember that small changes in annual returns can affect the future value of our investment. Thus, if your goal is to maximize future wealth, anything that decreases the annual returns should be avoided, and every opportunity that increases the annual returns should be undertaken.

## 📌 Sources

[What Is the Time Value of Money and Why Does It Matter?](https://www.thestreet.com/personal-finance/education/time-value-of-money-14796679)

[PVIFA (Present Value Interest Factor of Annuity)](https://studyfinance.com/present-value-interest-factor-of-annuity/)

[The rule of 72 for compound interest (Video)](https://www.youtube.com/watch?v=mec-QpjQMXY)

___

_Disclaimer: Author’s opinions are their own and do not constitute financial advice in any way whatsoever. Nothing published by IlonaCodes constitutes an investment recommendation, nor should any data or content published by IlonaCodes be relied upon for any investment activities._