# Construction Loan Interest Calculator A web-based tool to model monthly interest accrual on a construction loan with: - **Interest reserve** funded from the credit limit - Reserve draws added to principal - Optional capitalization of uncovered interest - Multiple draws over the term - **Day-count basis**: ACT/365 or ACT/360 - **Reserve analysis chart** to visualize trade-offs between total interest and out-of-pocket payments - **Suggested reserve** calculation based on a user’s out-of-pocket tolerance - Interactive **draggable handle** on the chart to set reserve --- ## Features ### Core Loan Model - Calculates interest for each month in the loan term. - Handles multiple draws at arbitrary months. - Reserve is funded from the credit limit and used to pay interest first. - Any reserve draw increases principal. - Option to capitalize uncovered interest (add unpaid interest to principal). ### Display - **Blue pills** for monthly and total interest amounts. - **Red pills** for uncovered interest (out-of-pocket) amounts greater than 0. - Total uncovered interest highlighted prominently above the table. ### Reserve Curve Analysis - Plots **total interest** (blue) and **out-of-pocket** uncovered interest (red) against different reserve amounts. - **X-axis is clamped** so reserve never exceeds `credit limit − total planned draws`. - Interactive vertical handle to adjust the reserve amount directly from the chart. - Shows current reserve and suggested reserve markers. ### Suggested Reserve - Input your **target uncovered ($)**. - Tool runs a binary search to find the smallest reserve that keeps out-of-pocket uncovered ≤ target. - Suggested reserve is displayed and marked on the chart. --- ## Usage 1. **Open application**. 2. Enter: - **Credit limit** - **APR (%)** - **Term (months)** - **Start date** - **Interest reserve** (optional) - **Day-count basis** - **Capitalize uncovered interest?** 3. Add draws (date & amount). 4. Click **Compute schedule** to see the monthly breakdown and totals. 5. To analyze reserves, click **Analyze reserve curve**. 6. To get a suggested reserve for your out-of-pocket limit, enter **Target uncovered** and click **Suggest reserve**. 7. Drag the chart’s vertical handle or use arrow keys (← →) to change the reserve interactively. --- ## Accessibility - Chart is keyboard-accessible: use arrow keys to move the handle (Shift+Arrow = ±1000, Arrow = ±100). - Color-coded interest and uncovered interest for quick scanning. --- ## Tech Stack - HTML, CSS, JavaScript (ES modules) - [`date-fns`](https://date-fns.org/) for date calculations - Canvas API for chart rendering --- ## License MIT