GETTING STARTED
The Treasury Daily Interest Rate Feed provides daily interest rate data in Extensible Markup Language (XML). Our data feed accepts GET requests, returns XML responses, and uses standard HTTP response codes.
For more information about the updates to XML feeds, please see the developer notice on XML data feeds.
DATA FEED URL STRUCTURE
For simplicity and consistency, data feed URLs are formatted with all lower-case characters. Underscores are used as word separators.
The components that make up a full data feed request are below.
BaseURL + Endpoint + Parameters
BASE URL:
https://home.treasury.gov
ENDPOINT:
/resource-center/data-chart-center/interest-rates/pages/xml
PARAMETERS EXAMPLE:
?data=daily_treasury_yield_curve&field_tdr_date_value=2022
FULL REQUEST EXAMPLE:
https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=daily_treasury_bill_rates&field_tdr_date_value=2022
DATA FEED INDEX
Endpoint |
Description |
---|---|
https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=[value]&field_tdr_date_value=[yyyy] |
Returns data for a given year |
https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=[value]&field_tdr_date_value=[all]&page=[xx] |
Returns data for all years |
https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=[value]&field_tdr_date_value_month=[yyyymm] |
Returns data for a given month |
AVAILABLE PARAMETERS
First parameter must be a data key and value; the second parameter is a time-period key and value.
-
Data
KEY = data
VALUE:- daily_treasury_yield_curve
- daily_treasury_bill_rates
- daily_treasury_long_term_rate
- daily_treasury_real_yield_curve
- daily_treasury_real_long_term
- Time period - must include the time-period as a second parameter with one of these two options:
- field_tdr_date_value to get data for specific year or for all year
KEY = field_tdr_date_value
VALUE:- yyyy
Example:
https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=[value]&field_tdr_date_value=[yyyy]https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=daily_treasury_yield_curve&field_tdr_date_value=2022
- all
KEY = page
VALUE = xxx (number)Example:
https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=[value]&field_tdr_date_value=[all]&page =[xxx]
https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=daily_treasury_yield_curve&field_tdr_date_value=all&page=24
An XML feed is available for retrieving all records, which you can use with pagination to return all data for a given interest rate type for “all” time periods. You can use the value “all” and a page number to retrieve the data.
Pagination (only available for the time period of "all")The data feed pagination uses a zero-based index, meaning that the pagination begins on page 0. If you call pagination, you must start at page zero (page=0) and make the increment. The first 300 rows or page zero (page=0) will return by default if you do not request pagination.
To loop through all pages, increments page number by one until there is no data inside the "<entry>" tag. Looping through years is possible by using the start year in the data below to loop through years to obtain a record of a specific time or for all time.
Data Availability
Interest Rate Type Available From Daily Treasury Par Yield Curve Rates 1990 Daily Treasury Bill Rates 2002 Daily Treasury Long-Term Rates 2000 Daily Treasury Par Real Yield Curve Rates 2003 Daily Treasury Real Long-Term Rates 2000 - field_tdr_date_value_month to get data for a given month
KEY = field_tdr_date_value_month
VALUE:
• yyyymmExample:
https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=[value]&field_tdr_date_value_month=[yyyymm]https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=daily_treasury_yield_curve&field_tdr_date_value_month=202204
- yyyy
- field_tdr_date_value to get data for specific year or for all year
DATA MODEL
The data in this feed using the OData Entity Data Model (EDM) datatypes. For more information, visit https://www.odata.org/documentation/odata-version-2-0/overview.
Primitive Types |
Literal Form |
Example |
Null |
null |
Example 1: null |
Edm.Binary |
binary'[A-Fa-f0-9][A-Fa-f0-9]*' OR X '[A-Fa-f0-9][A-Fa-f0-9]*' NOTE: X and binary are case sensitive. Spaces are not allowed between binary and the quoted portion. Spaces are not allowed between X and the quoted portion. Odd pairs of hex digits are not allowed. |
Example 1: X'23AB' Example 2: binary'23ABFF' |
Edm.Boolean |
true | false |
Example 1: true Example 2: false |
Edm.Byte |
[0-9]+ |
Example 1: 255 |
Edm.DateTime |
datetime'yyyy-mm-ddThh:mm[:ss[.fffffff]]' NOTE: Spaces are not allowed between datetime and quoted portion. datetime is case-insensitive |
Example 1: datetime'2000-12-12T12:00' |
Edm.Decimal |
[0-9]+.[0-9]+M|m |
Example 1: |
Edm.Double |
[0-9]+ ((.[0-9]+) | [E[+ | -][0-9]+])d |
Example 1: 1E+10d Example 2: 2.029d Example 3: 2.0d |
Edm.Single |
[0-9]+.[0-9]+f |
Example 1: 2.0f |
Edm.Guid |
guid'dddddddd-dddd-dddd-dddd-dddddddddddd' where each d represents [A-Fa-f0-9] |
Example 1: guid'12345678-aaaa-bbbb-cccc-ddddeeeeffff' |
Edm.Int16 |
[-][0-9]+ |
Example 1: 16 Example 2: -16 |
Edm.Int32 |
[-] [0-9]+ |
Example 1: 32 Example 2: -32 |
Edm.Int64 |
[-] [0-9]+L |
Example 1: 64L Example 2: -64L |
Edm.SByte |
[-] [0-9]+ |
Example 1: 8 Example 2: -8 |
Edm.String |
'<any UTF-8 character>' Note: See definition of UTF8-char in [RFC3629] |
Example 1: 'Hello OData' |
Edm.Time |
time'<timeLiteral>' timeLiteral = Defined by the lexical representation for dayTimeDuration in http://www.w3.org/TR/xmlschema11-2/#dayTimeDuration |
Example 1: PT13H20M |
Edm.DateTimeOffset |
datetimeoffset'<dateTimeOffsetLiteral>' dateTimeOffsetLiteral = Defined by the lexical representation for datetime (including timezone offset) at http://www.w3.org/TR/xmlschema-2 |
Example 1: 2002-10-10T17:00:00Z |