Amortization schedule in ruby
git clone https://github.com/jdcalvin/mortgage.git
cd mortgage
bundle install
cp sample.env .env
Run console with rake console
Mortgage.new(apr: 3.35, loan_amount: 320_000, value: 390_000, duration: 360).run(years:1)
+--------------+----------+----------+-----------+------------+-------------+-----------+------------+--------+
| Rate @ 3.35% | Monthly | Interest | Principal | Total Int. | Total Prin. | Total | Remaining | LTV |
+--------------+----------+----------+-----------+------------+-------------+-----------+------------+--------+
| 1. Dec 2020 | $1410.28 | $893.33 | $516.95 | $893.33 | $516.95 | $1410.28 | $319483.05 | 81.92% |
| 2. Jan 2021 | $1410.28 | $891.89 | $518.39 | $1785.22 | $1035.34 | $2820.56 | $318964.66 | 81.79% |
| 3. Feb 2021 | $1410.28 | $890.44 | $519.84 | $2675.66 | $1555.18 | $4230.84 | $318444.82 | 81.65% |
| 4. Mar 2021 | $1410.28 | $888.99 | $521.29 | $3564.65 | $2076.47 | $5641.12 | $317923.53 | 81.52% |
| 5. Apr 2021 | $1410.28 | $887.54 | $522.74 | $4452.19 | $2599.21 | $7051.4 | $317400.79 | 81.38% |
| 6. May 2021 | $1410.28 | $886.08 | $524.2 | $5338.27 | $3123.41 | $8461.68 | $316876.59 | 81.25% |
| 7. Jun 2021 | $1410.28 | $884.61 | $525.67 | $6222.88 | $3649.08 | $9871.96 | $316350.92 | 81.12% |
| 8. Jul 2021 | $1410.28 | $883.15 | $527.13 | $7106.03 | $4176.21 | $11282.24 | $315823.79 | 80.98% |
| 9. Aug 2021 | $1410.28 | $881.67 | $528.61 | $7987.7 | $4704.82 | $12692.52 | $315295.18 | 80.84% |
| 10. Sep 2021 | $1410.28 | $880.2 | $530.08 | $8867.9 | $5234.9 | $14102.8 | $314765.1 | 80.71% |
| 11. Oct 2021 | $1410.28 | $878.72 | $531.56 | $9746.62 | $5766.46 | $15513.08 | $314233.54 | 80.57% |
| 12. Nov 2021 | $1410.28 | $877.24 | $533.04 | $10623.86 | $6299.5 | $16923.36 | $313700.5 | 80.44% |
| 13. Dec 2021 | $1410.28 | $875.75 | $534.53 | $11499.61 | $6834.03 | $18333.64 | $313165.97 | 80.3% |
+--------------+----------+----------+-----------+------------+-------------+-----------+------------+--------+
| Rate @ 3.35% | Monthly | Interest | Principal | Total Int. | Total Prin. | Total | Remaining | LTV |
+--------------+----------+----------+-----------+------------+-------------+-----------+------------+--------+