Bonds are loans taken by a company. Simply speaking, company gets the money from the investors by selling its bonds. The company pays interest at predetermined intervals (usually annually or semiannually) and returns the principal on the maturity date, ending the loan. We support corporate bonds and government bonds in our datasets (for government bonds, see Economic Data API). There are always new corporate bonds on the market, if you didn’t find any particular bond, please contact us and we will try to add the data within 24 hours. Bond Fundamentals data could be accessed either via ISIN or via CUSIP IDs. Other IDs are not supported at the moment.
Quick jump:
Please note: before continuing to work with our APIs, make sure that you import and install all required libraries. A more detailed information about the functions of the Bonds Fundamentals API can be found on our documentation web-page.
Accessing the EODHD API
To access the EODHD API, we need to create an instance of the “APIClient” class and pass to it our API key. In this example, we will use the demo API key provided by EODHD, but in your real application, you should use your registered API key.
api = APIClient("demo")
Please, note that you can also specify the API key in a configuration file or as an environment variable, as described in the library documentation here.
1. Use the “demo” API key to test our data from a limited set of the tickers without registering:
AAPL.US | TSLA.US | VTI.US | AMZN.US | BTC-USD | EUR-USD
Real-Time Data and All of the APIs (except Bulk) are included without limitations on API calls.
2. Register to get your free API key (limited by 20 API calls per day) with access to:
End-Of-Day Historical Data with only past year for any ticker and List of tickers per Exchange
3. To unlock your API key we recommend to choose the subscription which covers your needs
Retrieving Bonds Fundamentals Data
After we are done with the API client, we can start to request bonds fundamentals data. US36166NAJ28 is an ISIN of a specific bond, it also could be a CUSIP (36166NAJ2 in this case) if you prefer using them. Other IDs are not supported at the moment.
bonds = api.get_bonds_fundamentals_data (isin = "US36166NAJ28")
The API response will be a single JSON structure.
Converting JSON Response to DataFrame
To convert JSON to DataFrame it is possible to use:
bf = pd.DataFrame(bonds)
print(bonds)
Conclusion
The Bonds Fundamentals API will help you to diversify beyond stocks. Also, it can inform you of from several types of risks associated with bonds that include interest rate risk, credit/default risk, and prepayment risk.