Message Boards Message Boards

Get U.S. treasury yield curve via Wolfram|Alpha?

Posted 5 years ago

Carl Lange on the Mathematica Stack Exchange site suggest I ask the following here as well...

Disturbingly coincident with the U.S. Treasury Yield Curve's recent volatility and inversion, the previously highly reliable & available data from the Treasury's website a Treasury's website xml data format, frequently becomes unreachable.

(Note: this data requires some parsing to become useful in Mathematica).

This unavailability also affects the Treasury's Resource Center website's Daily Treasury Yield Curve Rates presentation of the information, although not as often.

Treasury Resource Center

Not certain, of the underlying cause of the problem, I turned to WolframAlpha, which raises a couple of questions. ___________________

The U.S. Treasury publishes yield curve data at the end of each trading day. As I want the most current data I can typically access it by 4:15 PM Eastern time using the following WolframAlpha query:

WolframAlpha["United States, Treasury yield curve"]

WolfraAlpha query

I can, extract the relevant data values by adding "NumberData" to the query:

WolframAlpha["United States, Treasury yield curve", "NumberData"]

{{2, 1.79, 1.61, 1.5, 1.62, 2.11}}

But, this doesn't give me all yields available for all the maturities that the Treasury supplies.

Clicking on the WolframAlpha's "More" button shows that WolframAlpha has access to all of this data:

More maturities __________

Question 1: How can I access the yields from all available maturities? Essentially, I want to use "NumberData", but get all of the values.

Question 2: The WolframAlpha data lags the data published on the Treasury site (when one can get to it). In the cases shown, WolframAlpha accesses the August 22, 2019 data rather than the August 23, 2019 data available on the Treasury site. Over the past couple of weeks I have seen lags of as many of 3 trading days. How come? Does any way exist to to force/direct WolframAlpha to access more current data?

Alternatively: Can I access any of this data with FinancialData[] or some other direct means? One could previously get the U.S. Treasury 30 yield prices from which one can derive the 30 yield with:

FinancialData["^TYX"]

but this doesn't seem to work anymore.

The Yahoo link to this data still works.

Thoughts appreciated.

POSTED BY: Andreas Agas

Sorry to see there hasn't been any responses to your question. It will be useful for my purposes as well. Hope somebody brings a nice response.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract