The following example demonstrates how the FRED Client API can be used to acquire data pertaining to the 10-Year Treasury Constant Maturity Minus 2-Year Treasury Constant Maturity observations from the Federal Reserve Bank of St. Louis’ FRED economic research website:
Observations observations = queryBuilder
.series ()
.observations ()
.withSeriesId(“T10Y2Y“)
.doGetAsObservations ()
The call to doGetAsObservations performs a get on the following URI and converts the resultant XML into an instance of the FRED Client data model.
https://api.stlouisfed.org/fred/series/observations?api_key=[redacted]&series_id=T10Y2Y
The Observations returned contains a list of Observation instances which have date and value properties which are used to render the chart below.
See also:
[1] 10-Year Treasury Constant Maturity Minus 3-Month Treasury Constant Maturity (T10Y3M)
[2] 10-Year Treasury Constant Maturity Minus 2-Year Treasury Constant Maturity (T10Y2Y)
[3] 2-Year Treasury Constant Maturity Rate (DGS2)
[4] Interest Rate Spreads
[5] Coherent Logic Enterprise Data Adapter