finance.bond_ytm
Calculates a bond's annual yield to maturity from price, face value, coupon rate, years, and payment frequency using Newton's method, and reports whether the result converged.
Instructions
채권 만기수익률(YTM)을 뉴턴법으로 구한다. price 와 face 는 양수 Decimal 문자열, coupon_rate 는 연 표면이율 소수 (예 0.05), years 는 만기 연수 정수, freq 는 연 이자지급 횟수(기본 2). ytm 은 기간 수익률 x freq 인 연율이다. 수렴하지 못하면 converged=false 로 마지막 추정값이 나오므로 확인해야 하며 이자 지급일 사이의 경과이자는 지원하지 않는다.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tol | No | 1e-10 | |
| face | Yes | ||
| freq | No | ||
| price | Yes | ||
| years | Yes | ||
| max_iter | No | ||
| coupon_rate | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ytm | Yes | ||
| _meta | No | 서버가 붙이는 영수증(integrity), 엔진, 힌트 | |
| trace | Yes | 계산 근거(tool, formula, inputs, steps, output) | |
| converged | Yes | ||
| iterations | Yes |