Fixed Income

The Fixed Income module covers a wide variety of calculations including the Effective Yield, Macaulay Duration, Modified Duration, Convexity, Yield to Maturity and derivative pricing models such as Black and Bachelier (used for Swaptions and other instruments).

Every function of the Fixed Income module has its own page with what it measures, an example and the code. Pick one from the sidebar on the left.Every function of the Fixed Income module has its own page with what it measures, an example and the code. Pick one from the .

Use it in Claude, ChatGPT or another AI assistant through the Finance Toolkit MCP, or install the Python package:

pip install financetoolkit -U

Getting Started

The Fixed Income module covers two sides of the bond market. The first is individual bonds: prices, yields, duration and convexity for every US Treasury and for thousands of corporate bonds, calculated from their market prices. The second is market data: Euribor, the policy rates of the European Central Bank and the Federal Reserve, government bond yields for 40+ countries and the ICE BofA corporate bond indices by rating and maturity.

The Treasury prices come from the Treasury’s own daily FedInvest prices and the market data from public sources, so neither needs an API key. The corporate bonds come from the published holdings of bond ETFs, and their spread over Treasuries uses the Treasury par yield curve, which takes a FinancialModelingPrep API key.

Loading the Module

The Fixed Income module can be imported on its own, or reached through companies.fixedincome after you initialise a Toolkit. Here it is imported directly. To set it up with market data from 2012 onwards:

from financetoolkit import FixedIncome

fixedincome = FixedIncome(start_date="2012-01-01", api_key="FINANCIAL_MODELING_PREP_KEY")

The start_date only affects the market data functions; the bond functions price on a single day, the latest by default or the one you pass as date.

Bond Statistics of the Benchmark Treasuries

collect_bond_statistics returns the key figures of individual bonds in one call. Without bonds or an issuer it takes the benchmark Treasuries: the note or bond maturing closest to 2, 3, 5, 7, 10, 20 and 30 years after the price date. To calculate their statistics on 5 November 2026 and keep the main columns:

statistics = fixedincome.collect_bond_statistics(date="2026-11-05")

statistics[["Coupon", "Maturity", "Price", "Yield to Maturity", "Modified Duration", "DV01", "Convexity"]]

Which returns:

CUSIP Coupon Maturity Price Yield to Maturity Modified Duration DV01 Convexity
91282CRU7 0.0462 2028-10-31 100.3125 0.0446 1.8777 0.0188 4.5145
91282CLR0 0.0412 2029-10-31 98.875 0.0453 2.7748 0.0275 9.2977
91282CRT0 0.0475 2031-10-31 100.6875 0.0459 4.3963 0.0443 22.7527
91282CRV5 0.0488 2033-10-31 101.0625 0.0469 5.8687 0.0593 40.7069
91282CRF0 0.0462 2036-08-15 98.4375 0.0483 7.6914 0.0765 71.6857
912810RU4 0.0288 2046-11-15 70.0312 0.0533 13.6289 0.0973 241.4593
912810UW6 0.0512 2056-08-15 98.125 0.0525 14.8801 0.1477 333.2043

The yield rises from 4.46% at two years to 5.33% at twenty, and the 30-year bond yields a little less than the 20-year one. The modified duration says how much the price moves for a one percentage point change in the yield: 1.9% for the two-year note against 14.9% for the 30-year bond. The DV01 puts that in money, 0.15 per 100 of par for a one basis point move in the 30-year yield. The 20-year bond trades at 70 because its 2.88% coupon is far below today’s yields.

The same statistics are available for any bond by CUSIP or ISIN with bonds=, for an issuer’s bonds with issuer=, or for every bill, note and bond in a maturity range.

Every Treasury Security on One Day

get_treasury_securities lists every marketable US Treasury, about 460 bills, notes, bonds, TIPS and floating rate notes, with its price, yield to maturity and modified duration. To get them for the same day:

treasuries = fixedincome.get_treasury_securities(date="2026-11-05")

Which gives one row per security. Averaged per year to maturity, the nominal bills, notes and bonds set against the TIPS, whose yield is a real yield:

The nominal yields climb from 4.16% within a year to about 5.3% from twenty years out. TIPS yield 2.35% to 3.1% over the same maturities, so the gap between the two, the inflation the market prices in, is about 2.2 percentage points at ten years and at thirty.

Corporate Bonds from ETF Holdings

Prices of individual corporate bonds are not published for free, but bond ETFs publish their holdings every day. get_bond_universe reads them, about 8,000 investment grade and high yield bonds by default, and calculates each bond’s yield, duration and G-spread, its yield over the Treasury curve at the same maturity. To get the bonds of Apple:

apple_bonds = fixedincome.get_bond_universe(issuer="APPLE INC")

Which gives Apple’s bonds from 2028 to 2062, here with the yield to maturity and the G-spread in a tab each:

Apple’s 43 bonds yield from 4.6% for 2028 to 6.0% for the 2050s and 2060s, at 0.17 to 0.32 percentage points over Treasuries up to 2032 and about 0.7 points for the bonds maturing after 2040. The bonds maturing from 2049, most issued with coupons of 2.4% to 3% when rates were low, trade at 50 to 62.

Euribor and Central Bank Rates

Swaps reference a benchmark rate such as Euribor or SOFR, and those in turn follow the policy rates of the central banks. To get the Euribor rates for four maturities:

euribor = fixedincome.get_euribor_rates()

Which gives monthly rates since 2012, here with the European Central Bank’s hiking cycle shaded:

The 3-month Euribor was below zero from May 2015 to June 2022, bottomed at -0.6% at the end of 2021, and then rose to 4% by October 2023 as the European Central Bank fought inflation. It came back to about 2% in 2025, and the 12-month rate climbing above the shorter maturities again shows the market expecting higher rates ahead.

The policy rates themselves are available for the European Central Bank (refinancing, marginal lending and deposit facility rates) and the Federal Reserve (the effective federal funds rate, its percentiles and volume, and the target range). To get both:

ecb_rates = fixedincome.get_european_central_bank_rates()

fed_rates = fixedincome.get_federal_reserve_rates()

Which gives daily series, shown here as one observation per month. The first tab sets the ECB deposit rate against the effective federal funds rate, the other two show each central bank’s rates in full, with the Federal Reserve’s target range shaded:

The two took very different paths into the same hiking cycle. The ECB kept its deposit rate below zero from 2014 to 2022, at -0.5% from 2019, while the Federal Reserve had already raised rates to 2.4% by 2019. Both then hiked hard in 2022 and 2023, the ECB to 4% and the Fed to a target range of 5.25%-5.50%, with the effective rate at 5.33%. Today the deposit rate is 2.5% and the effective federal funds rate 3.88%.

Government Bond Yields

Government bond yields are the risk-free benchmark against which every other bond is priced. get_government_bond_yield returns the 10-year yield by default and the 3-month yield with short_term=True. To get the 10-year yields and select five large bond markets:

government_bond_yields = fixedincome.get_government_bond_yield(short_term=False)

government_bond_yields[["United States", "Japan", "Germany", "China", "United Kingdom"]]

Which gives quarterly yields for the five markets, and in the second tab the latest yield of every country, ranked:

German and Japanese yields went below zero around 2019 and 2020, with Germany at -0.6%, while the United States and the United Kingdom are now at about 4.8% and 5%. China moved the other way, from about 4.5% in 2014 to 1.7%. Across countries, the latest 10-year yields range from 12.3% in Colombia to 0.5% in Switzerland, with emerging markets such as Mexico, Brazil and South Africa near 9%.

Corporate Bonds: ICE BofA Indices

The ICE BofA corporate bond indices are widely used benchmarks for valuing fixed income portfolios. The option-adjusted spread (OAS) is the spread of an index over the Treasury curve after removing the value of embedded options such as call features, in basis points. It is the cleanest measure of what the market charges for credit risk. To get the spreads per credit rating:

fixedincome.get_ice_bofa_option_adjusted_spread(maturity=False)

Which gives a daily spread per rating, shown here weekly and split into high yield and investment grade, with the April 2025 tariff shock shaded:

Spreads run from about 40 basis points for AAA to more than 1,000 for CCC, and every rating jumped in the tariff shock of April 2025 before coming back within weeks. Since then the CCC bucket has widened on its own, to 1,310 basis points, the widest in the three years shown, while BB and B at 200 and 336 and the investment grade ratings are still close to the tight end of their range.

The yield to worst is the lowest yield an investor can receive on a bond without the issuer defaulting, taking into account that the issuer may call the bond early. That makes it the conservative yield measure for callable bonds. To get it per maturity bucket:

fixedincome.get_ice_bofa_yield_to_worst(maturity=True)

Which gives a daily yield per maturity bucket. The first tab compares the curve at the start of the data with the latest one, the second shows it weekly over time:

In October 2023 the corporate curve was almost flat, from 6.1% for 1-3 years to 6.5% for 15+ years. Short yields have since fallen to 5.3% with the policy rate, while the long end stayed at 6.5%, so the curve is now upward sloping by more than a percentage point.

The same indices are available as effective yield (get_ice_bofa_effective_yield) and total return (get_ice_bofa_total_return), each by rating or by maturity.

All Methods

The Fixed Income module has 74 methods, each with a page of its own:

Bond Valuations

  • Present ValueCalculates the present value of individual bonds: what their coupons and principal are worth when discounted with the Treasury zero-coupon curve of the price date, next to the price they trade at.
  • Duration MetricsCalculates the duration of individual bonds at their yield to maturity: how sensitive the price of each bond is to a change in its yield, or how long on average its cash flows take to arrive.
  • Yield to MaturityCalculates the yield to maturity of individual bonds from their market price: the internal rate of return of the bond, the discount rate that equates the present value of the bond's cash flows to its…
  • Par YieldCalculates the par yields of any maturity from a country's zero-coupon (spot) yield curve on a day: the coupon rate a newly issued bond of each maturity needs so that, discounted with the spot curve…
  • Forward RateCalculates the implied forward rates between pairs of maturities of a country's zero-coupon (spot) yield curve on a day: the interest rate, implied by that day's curve, for a loan that starts at a…
  • Key Rate DurationCalculates the key rate durations of individual bonds on the Treasury zero-coupon curve: the price sensitivity to a shock at a single maturity ("key rate") of the curve while every other point is…
  • Yield Curve SpreadCalculates the spreads between pairs of maturities of a country's government bond yield curve on a day: the slope of the curve, e.g. the widely followed 10-year minus 2-year and 10-year minus 3-month…
  • Z-SpreadCalculates the zero-volatility spread (Z-spread) of individual bonds over the Treasury zero-coupon curve: the constant spread that, when added uniformly to every point of the curve, makes the present…
  • Breakeven Inflation RateCalculates the breakeven inflation rates of the US Treasury curve on a day: the nominal par yield minus the real (TIPS) par yield of the 5, 7, 10, 20 and 30-year maturities.
  • Bond-Equivalent YieldCalculates the bond-equivalent yield (BEY) of every Treasury bill from its price: the return of the bill on a basis comparable to coupon-bearing notes and bonds.
  • Taylor Series Price ChangeEstimates the percentage change in the price of individual bonds for a change in their yield, using a second-order Taylor series expansion that combines modified duration and convexity.
  • Bucketed DeltaCalculates the bucketed delta of individual bonds on the Treasury curve: the change in each bond's present value, per 100 of par, when one maturity of the curve rises by a basis point, for every…
  • Rate Shift LadderCalculates the parallel shift ladder of individual bonds on the Treasury zero-coupon curve: the profit or loss, per 100 of par, when the whole curve shifts up or down by each of a range of amounts…

Government Bonds

  • 3-Month Government Bond YieldShort-term interest rates are the rates at which short-term borrowings are effected between financial institutions or the rate at which short-term government paper is issued or traded in the market.
  • 10-Year Government Bond YieldGet the government bond yield for a variety of countries over time from the OECD: what governments pay to borrow, by default the long-term (10-year) government bond yield or else the short-term…
  • U.S. Treasury Par Yield CurveRetrieves the daily U.S.
  • Government Bond Yield CurveRetrieves the government bond yield curve of a variety of countries: the yield of every maturity a country's government borrows at, from treasury bills to bonds of 30 years and more.
  • Bank of England Yield CurveRetrieves the UK yield curves the Bank of England estimates daily from 1985: the spot rates of UK government bonds (gilts) and of overnight index swaps on SONIA (OIS, from 2009), for maturities from…
  • Treasury AuctionsRetrieves the results of the US Treasury auctions held between the start and end date: every bill, note, bond, TIPS and floating rate note the Treasury sold, with the yield it sold at, how many times…
  • Treasury SecuritiesRetrieves every marketable US Treasury (bills, notes, bonds, TIPS and floating rate notes) with its price, yield to maturity and modified duration on a day, without an API key: what each Treasury…
  • Term PremiumRetrieves the Treasury term premia of Adrian, Crump and Moench (2013): the extra yield investors demand for holding a long Treasury instead of rolling over short ones, as the Federal Reserve Bank of…
  • Fitted Bond CurveFits the US Treasury zero-coupon curve to the prices of every Treasury note and bond on a day, from the Treasury's FedInvest prices: the term structure the bonds themselves imply, with each bond's…
  • Treasury Floating Rate Notes (FRNs)Calculates the discount margin, yield and durations of every US Treasury floating rate note (FRN) from its FedInvest price: what each note pays over its index and how its price responds to the index…
  • Treasury Inflation-Protected Securities (TIPS)Calculates the index ratio, inflation-adjusted price and breakeven inflation rate of every US Treasury Inflation-Protected Security (TIPS) from its FedInvest price: how much inflation has lifted each…
  • Treasury Forward PricesCalculates the forward price of every US Treasury bill, note and bond: the price for delivery at a later date at which buying the security today with money borrowed in the repo market and selling it…
  • Treasury Futures BasisCalculates the conversion factor, basis and implied repo rate of every Treasury that can be delivered into a CME US Treasury futures contract: what delivering each costs and earns against the futures…

Corporate Bonds

  • Option Adjusted Spread (OAS)Retrieves the ICE BofA Option-Adjusted Spreads (OASs): the extra yield that US corporate bonds of a given maturity or rating category pay over a spot Treasury curve once their embedded options are…
  • Bond UniverseRetrieves thousands of individual US dollar bonds with their price, yield to maturity, modified duration and spread over Treasuries, read from the holdings of bond ETFs.
  • Effective YieldRetrieves the effective yield of the ICE BofA Indices: the yield that US corporate bonds of a given maturity or rating category pay, an index of the cost of corporate borrowing.
  • Total ReturnRetrieves the total return of the ICE BofA Indices: the gain of holding US corporate bonds of a given maturity or rating category, coupons and price changes included.
  • Yield to WorstRetrieves the semi-annual yield to worst of the ICE BofA Indices: the lowest yield US corporate bonds of a given maturity or rating category pay if their issuers redeem them at the least favourable…
  • Corporate Bond YieldsRetrieves the yields of corporate bonds of a variety of countries, by rating where the source splits them, monthly and with long histories: the input for a credit spread factor outside the United…
  • Moody's Corporate Bond YieldsRetrieves Moody's seasoned corporate bond yields for Aaa (the highest rating) and Baa (the lowest investment grade rating) US corporate bonds: what the safest and the riskiest investment grade…
  • HQM Corporate Bond Yield CurveRetrieves the High Quality Market (HQM) corporate bond yield curve of the U.S.
  • HQM Corporate Bond SpreadComputes the credit spread of high quality US corporate bonds per maturity: the Treasury's High Quality Market (HQM) corporate par yield minus the Treasury constant maturity yield, at 2, 5, 10 and 30…
  • Corporate Borrowing Cost (ECB)Retrieves the composite cost of borrowing for non-financial corporations the European Central Bank publishes monthly from 2003, for the euro area and every member: the average interest rate on new…
  • Issuer SpreadsCompares the credit spreads of bond issuers at the same maturities: the G-Spread (yield to maturity minus the Treasury par yield) of each issuer at, for example, 2, 5 and 10 years, interpolated…

Credit Risk & Stress

  • Rating Transition MatrixRetrieves the rating transition matrix of a credit rating agency: for every rating at the start of a period, the share of ratings that ended the period in each rating category, in default or…
  • Default RatesRetrieves the one-year default rates per rating of a credit rating agency, year by year from 1989: the share of the ratings outstanding at the start of each year that defaulted within it.
  • Excess Bond PremiumRetrieves the credit spread of Gilchrist and Zakrajšek (2012) and its excess bond premium, monthly from 1973, as the Federal Reserve Board updates them.
  • Financial Stress Index (CISS)Retrieves the Composite Indicator of Systemic Stress (CISS) the European Central Bank publishes daily for the euro area, its largest members, the United Kingdom, the United States and China, back to…
  • Implied Default ProbabilityCalculates the default probabilities that credit spreads imply: how likely the market prices a default of an issuer of each rating within each horizon.
  • Survival CurveBootstraps survival curves, the probability that a US corporate issuer has not defaulted after each horizon, from the ICE BofA option-adjusted spreads.
  • Credit Default Swap (CDS) SpreadCalculates the CDS-equivalent spreads of US corporate credit: the spread a protection buyer would pay each year to insure against a default of an issuer with that credit, by maturity or by rating.

Regulatory Curves

  • EIOPA Risk-Free RateRetrieves the risk-free interest rate term structures the European Insurance and Occupational Pensions Authority (EIOPA) publishes monthly: the curves European insurers must discount their…
  • EIOPA Symmetric AdjustmentRetrieves the symmetric adjustment of the equity capital charge of Solvency II: how much the "equity dampener" EIOPA publishes, daily from 1991, raises or lowers the equity charges of the standard…

Central Banks

  • Euro Interbank Offered Rate (Euribor)Retrieves the Euribor rates, short for Euro Interbank Offered Rate: the interest rates at which a panel of European banks lend funds to one another in the interbank market.
  • Secured Overnight Financing Rate (SOFR)The SOFR is calculated as a volume-weighted median of transaction-level tri-party repo data collected from the Bank of New York Mellon as well as GCF Repo transaction data and data on bilateral…
  • Main Refinancing Operations (ECB)The main refinancing operations (MRO) rate is the interest rate banks pay when they borrow money from the ECB for one week.
  • Marginal Lending Facility (ECB)The marginal lending facility rate is the interest rate banks pay when they borrow from the ECB overnight.
  • Deposit Facility (ECB)The deposit facility rate is one of the three interest rates the ECB sets every six weeks as part of its monetary policy.
  • Effective Federal Funds Rate (EFFR)Get the Federal Reserve rates as published by the Federal Reserve Bank of New York: the overnight rates at which US banks and other institutions borrow dollars, unsecured or against Treasury…
  • Overnight Bank Funding Rate (OBFR)The overnight bank funding rate (OBFR) is calculated as a volume-weighted median of overnight federal funds transactions, Eurodollar transactions, and the domestic deposits reported as “Selected…
  • Tri-Party General Collateral Rate (TGCR)The TGCR is calculated as a volume-weighted median of transaction-level tri-party repo data collected from the Bank of New York Mellon.
  • Broad General Collateral Rate (BGCR)The BGCR is calculated as a volume-weighted median of transaction-level tri-party repo data collected from the Bank of New York Mellon as well as GCF Repo transaction data obtained from the U.S.

Yield Curves

  • Zero-Coupon CurveCalculates the zero-coupon (spot) yield curve of a country by bootstrapping its government bond par yields: the single rate that discounts a payment at each maturity.
  • Nelson-Siegel-SvenssonFits the Nelson-Siegel-Svensson model to the zero-coupon yield curve of a country on every date: the level, slope and curvature factors that describe each curve with a few parameters.
  • Yield Curve Principal ComponentsCalculates the principal components of a country's government bond yield curve: the few independent movements that explain nearly all of how the curve changes.
  • Carry and Roll-DownCalculates the carry and roll-down of zero-coupon government bonds on every date: the return in excess of financing that a bond of each maturity earns over the horizon if the yield curve stays as it…
  • Instantaneous Forward CurveCalculates the instantaneous forward curve of a country's zero-coupon curve on a day: at every maturity t, the rate the curve implies for borrowing over an infinitesimal period starting at t.
  • Smith-Wilson CurveExtends a country's government bond yield curve to any maturity with the Smith-Wilson method (Smith and Wilson, 2001): the risk-free curve that prices every bill and par bond of the curve exactly…

Swaps & Forwards

  • Swap RatesCalculates the par swap rates and annuities of interest rate swaps of any maturity on a single curve: the fixed rate at which a new fixed-for-floating swap is worth nothing, and the present value of…
  • Forward Rate Agreements (FRAs)Calculates the rates of forward rate agreements (FRAs) from a zero-coupon curve: the simple interest rate, fixed today, of a loan that starts and ends at future dates.
  • Asset Swap SpreadCalculates the par and the market value asset swap spreads of US dollar corporate bonds over the swap curve: the spread over the floating rate at which a swap that pays away the bond's coupons turns…
  • I-SpreadCalculates the I-spread (interpolated spread) of US dollar corporate bonds: the yield to maturity over the par swap rate of the bond's maturity.
  • FX Forward RatesCalculates FX forward rates by covered interest parity: the exchange rate, agreed today, at which currencies are exchanged at a future date.

Inflation

  • Inflation Swap RateCalculates the zero-coupon and year-on-year inflation swap rates the government bond market implies: the inflation the market expects, as the fair fixed rates of swaps on US CPI-U inflation (from…
  • Forward Inflation IndexCalculates the forward US consumer price index (CPI-U, not seasonally adjusted) of every coming month: the price level the inflation swap rates the Treasury and TIPS curves imply, with the monthly…

Short-Rate Models

  • Short-Rate ModelCalibrates the Vasicek and Cox-Ingersoll-Ross (CIR) short-rate models to the history of a country's short-term government bond yield: how fast the rate reverts to its long-run mean and how volatile…
  • Short-Rate SimulationSimulates the future path of a country's short-term interest rate with the Hull-White, Vasicek or Cox-Ingersoll-Ross model: the distribution of the rate per step, the mean and the 5th, 25th, 50th…
  • Swaption PricesCalculates the prices of European or Bermudan swaptions for a grid of expiries and swap tenors in a one-factor short-rate model fitted to today's government zero-coupon curve: what the right to enter…

Loans

  • Loan PaymentCalculates the monthly payment of a new 30-year fixed-rate mortgage at every weekly US mortgage rate: what the same loan costs a buyer at each date, with the total interest over its life, the…
  • Affordable LoanCalculates the loan a fixed monthly payment carries at every weekly US mortgage rate: the 30-year fixed-rate mortgage the payment repays, and how that loan compares with the one it carried at the…
  • Amortization ScheduleCalculates the amortization schedule of a new 30-year fixed-rate mortgage at the US mortgage rate of a date: per monthly payment the part that is interest, the part that repays the loan and the…