tbill_yield_methodology
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tbill_yield_methodology [2023/12/21 18:58] – created raju | tbill_yield_methodology [2024/02/27 23:03] (current) – [Example 4] raju | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== dummy ==== | + | ===== dummy ===== |
- | Example: 912797JA6 is a tbill with 28 days maturity. It was sold for $99.5905 on 2023-12-21. What is the yield? | + | ==== Example 1 ==== |
+ | Example: 912797JA6 is a tbill with a maturity of 28 days. It was sold for $99.5905 on 2023-12-21. What is the yield? | ||
Ans: | Ans: | ||
Line 10: | Line 11: | ||
</ | </ | ||
- | where y is 366, r is the days to maturity. | + | where y is the days in year, r is the days to maturity. |
< | < | ||
- | In [25]: | + | In [1]: |
- | def tbill_yield(P, r): | + | def tbill_yield_short_maturity(P, r, y): |
- | y = 366 | + | i = ((100 - P) / P) * (y / r) |
- | i = ((100 - P) / P) * (y/r) | + | i = round(i * 100, 3) |
- | i = round(i*100, | + | return i |
- | return(i) | + | |
- | In [26]: | + | In [2]: |
- | tbill_yield(99.5905, 28) | + | tbill_yield_short_maturity(99.5905, 28, 366) |
- | Out[26]: | + | Out[2]: |
5.375 | 5.375 | ||
</ | </ | ||
Line 35: | Line 36: | ||
* https:// | * https:// | ||
* https:// | * https:// | ||
+ | |||
+ | |||
+ | ==== Example 2 ==== | ||
+ | On https:// | ||
+ | |||
+ | ^ Security Term ^ CUSIP ^ Issue Date ^ Maturity Date ^ High Rate ^ Investment Rate ^ | ||
+ | | 4-Week | 912797JB4 | 01/02/2024 | 01/30/2024 | 5.325% | 5.436% | | ||
+ | |||
+ | It was bought on 12/28/2023, settlement date = 1/2/2024 for a price of 99.585833. The yield on it is | ||
+ | |||
+ | < | ||
+ | In [1]: | ||
+ | from tbill_yield import tbill_yield_short_maturity | ||
+ | tbill_yield_short_maturity(99.585833, | ||
+ | Out[1]: | ||
+ | 5.436 | ||
+ | </ | ||
+ | |||
+ | The 5.436 matches with the Investment Rate in the table. | ||
+ | |||
+ | So 'Issue Date' in the table is the settlement date. | ||
+ | |||
+ | ==== Example 3 ==== | ||
+ | On https:// | ||
+ | ^ Security Term ^ CUSIP ^ Issue Date ^ Maturity Date ^ High Rate ^ Investment Rate ^ | ||
+ | | 4-Week | 912797JC2 | 01/09/2024 | 02/06/2024 | 5.290% | 5.400% | | ||
+ | |||
+ | It was bought on 01/04/2024, settlement date = 1/9/2024 for a price of 99.588556. The yield on it is | ||
+ | |||
+ | < | ||
+ | In [2]: | ||
+ | from tbill_yield import tbill_yield_short_maturity | ||
+ | tbill_yield_short_maturity(99.588556, | ||
+ | Out[2]: | ||
+ | 5.4 | ||
+ | </ | ||
+ | |||
+ | The precision in the price matters. If you only have 4 significant digits after the decimal, the result will not match with the ' | ||
+ | < | ||
+ | In [3]: | ||
+ | tbill_yield_short_maturity(99.5885, | ||
+ | Out[3]: | ||
+ | 5.401 | ||
+ | </ | ||
+ | |||
+ | Conclusion: Price should have 6 significant digits after the decimal. | ||
+ | |||
+ | ==== Example 4 ==== | ||
+ | https:// | ||
+ | |||
+ | ^ Bills ^ CMB ^ CUSIP ^ Issue Date ^ High Rate ^ Investment Rate ^ Price per $100 ^ | ||
+ | | 42-Day | Yes | 912797HF7 | 02/29/2024 | 5.290% | 5.397% | $99.382833 | | ||
+ | | 42-Day | Yes | 912797GZ4 | 02/22/2024 | 5.280% | 5.401% | $99.384000 | | ||
+ | |||
+ | https:// | ||
+ | |||
+ | ^ Security Term ^ CUSIP ^ Issue Date ^ Maturity Date ^ High Rate ^ Investment Rate ^ | ||
+ | | 42-Day | 912797HF7 | 02/29/2024 | 04/11/2024 | 5.290% | 5.397% | | ||
+ | | 42-Day | 912797GZ4 | 02/22/2024 | 04/04/2024 | 5.280% | 5.401% | | ||
+ | |||
+ | Combining both, we get | ||
+ | ^ Security Term ^ CMB ^ CUSIP ^ Issue Date ^ Maturity Date ^ High Rate ^ Investment Rate ^ Price per $100 ^ | ||
+ | | 42-Day | Yes | 912797HF7 | 02/29/2024 | 04/11/2024 | 5.290% | 5.397% | $99.382833 | | ||
+ | | 42-Day | Yes | 912797GZ4 | 02/22/2024 | 04/04/2024 | 5.280% | 5.401% | $99.384000 | | ||
+ | |||
+ | Notice how yield (Investment Rate) went down (from 5.401% to 5.397%) even though price went down (from \$99.384000 to \$99.382833) for the first entry? This is because the 'days in year' changes from 366 to 365. | ||
+ | |||
+ | < | ||
+ | $ ipython | ||
+ | |||
+ | In [1]: | ||
+ | from tbill_yield import tbill_yield_short_maturity | ||
+ | tbill_yield_short_maturity(99.384000, | ||
+ | Out[1]: | ||
+ | 5.401 | ||
+ | |||
+ | In [2]: | ||
+ | tbill_yield_short_maturity(99.382833, | ||
+ | Out[2]: | ||
+ | 5.397 | ||
+ | </ | ||
+ | |||
+ | Ref: https:// | ||
tbill_yield_methodology.1703185136.txt.gz · Last modified: 2023/12/21 18:58 by raju