🛠️ToolsShed

복리 계산기

시간에 따른 투자의 복리 성장 계산.

복리 계산기는 원금뿐만 아니라 이전 기간에 쌓인 이자에도 이자가 붙을 때 투자나 저축이 시간이 지남에 따라 어떻게 성장하는지 보여줍니다. 알버트 아인슈타인은 복리를 세계 8대 불가사의라고 불렀다고 전해집니다 — 이율이나 시간의 작은 차이가 장기간에 걸쳐 극적으로 다른 결과를 낳을 수 있습니다.

원금, 연 이자율, 복리 주기(일간, 월간, 분기별, 연간), 기간(연)을 입력하면 최종 잔액, 총 이자 수익, 성장이 시간이 지남에 따라 어떻게 가속화되는지 볼 수 있는 연도별 내역이 표시됩니다.

복리 이해는 은퇴 계획, 저축 계좌 평가, 대출 비용 비교, 정보에 입각한 투자 결정을 내리는 데 필수적입니다. 핵심 인사이트는 일찍 시작하고 수익을 재투자하면 나중에 더 높은 이율로 시작하는 것보다 훨씬 더 많은 부를 창출할 수 있다는 것입니다.

자주 묻는 질문

코드 구현

def compound_interest(principal, annual_rate, years, n=12, contribution=0):
    """
    Calculate compound interest with optional regular contributions.

    Parameters:
        principal    - initial investment
        annual_rate  - annual interest rate (e.g. 0.07 for 7%)
        years        - investment duration in years
        n            - compounding frequency per year (12 = monthly)
        contribution - periodic contribution (same frequency as n)

    Returns dict with final balance, total invested, and total interest.
    """
    r = annual_rate / n
    periods = int(years * n)
    balance = principal
    for _ in range(periods):
        balance = balance * (1 + r) + contribution
    total_invested = principal + contribution * periods
    return {
        "final_balance":  balance,
        "total_invested": total_invested,
        "total_interest": balance - total_invested,
    }

def rule_of_72(annual_rate):
    """Estimate years to double at a given annual rate."""
    return 72 / (annual_rate * 100)

# Simple formula (no contributions)
def compound_formula(P, r, n, t):
    """A = P(1 + r/n)^(nt)"""
    return P * (1 + r / n) ** (n * t)

# Examples
result = compound_interest(10000, 0.07, 20, n=12, contribution=500)
print(f"Final balance:   ${result['final_balance']:,.2f}")
print(f"Total invested:  ${result['total_invested']:,.2f}")
print(f"Total interest:  ${result['total_interest']:,.2f}")
print(f"Years to double: {rule_of_72(0.07):.1f} years at 7%")

# Compounding frequency comparison
for label, n in [("Annual", 1), ("Monthly", 12), ("Daily", 365)]:
    A = compound_formula(10000, 0.12, n, 10)
    print(f"{label:8}: ${A:,.2f}  (EAR = {((1 + 0.12/n)**n - 1)*100:.4f}%)")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.