Re: The FinancialData Function
- To: mathgroup at smc.vnet.net
- Subject: [mg87211] Re: The FinancialData Function
- From: jasonc <jasonc at wolfram.com>
- Date: Fri, 4 Apr 2008 02:58:05 -0500 (EST)
- References: <fsibce$64l$1@smc.vnet.net> <ft2arl$pf2$1@smc.vnet.net>
To Harvey:
On oil prices, that is one in the coming soon category, but I can give
you a solution that will work today, outside of FinancialData proper.
Soon there won't be a need for these sorts of lines, that is sort of
the idea. But for now, you can use -
Daily spot oil prices from the Department of Energy, back to 1986
dailyDOEOil = {#[[1, 1 ;; 3]], N[#[[2]]]} & /@ DeleteCases[
Import["http://tonto.eia.doe.gov/dnav/pet/xls/
PET_PRI_SPT_S1_D.xls", "XLS"][[2, 4 ;;, 1 ;; 2]], {"", ""} | {_, ""}];
Monthly spot oil prices from the Fed, back to 1946
monthlyFedOil = {DateList[#[[1]]][[1 ;; 3]], N[#[[2]]]} & /@ Rest[
Import["http://research.stlouisfed.org/fred2/series/OILPRICE/
downloaddata/OILPRICE.csv"]];
Both are in the same format as any other FinancialData time series,
and ready for a DateListPlot, etc. I hope they help in the meantime.
A prime reason we made FinancialData is to spare everyone else the
need to figure out the fiddly details of such lines of code.
As for getting lists of symbols that work in FinancialData today, you
can use string patterns and wildcards in the first argument, and
"Lookup" in the second argument. So e.g. just to see how many that
is, you could ask for
Length[FinancialData["*", "Lookup"]]
- where the * is a wildcard that will match any string. The answer is
186,000 symbols and change. I won't try to guarantee that every one
of them will give you meaningful data - some will return Missings,
representing entities that merged recently or failed etc. For any
subset of them, the symbol and second argument "Name" will tell you
what it is.
Clearly this sort of discovery can be improved, and is another area
I'd call experimental. Briefly, there is good coverage of stocks,
mutual funds, and indices in the existing data. Including many
foreign exchanges. Newer versions should have more of the futures and
economic time series you'd want for commodity-specific questions.
Fine questions by the way.
Sincerely,
Jason Cawley