Message Boards Message Boards

GROUPS:

Get FinancialData price history?

Posted 1 year ago
7541 Views
|
47 Replies
|
2 Total Likes
|

Since 16 may 2017, why am I not able to get the price history of US stock market tickers? Please see output below! Has anything changed?

In[9]:= FinancialData["GE", {{2017, 1, 3}, {2017, 5, 15}}]

Out[9]= Missing["NotAvailable"]

In[10]:= FinancialData["IBM", {{2017, 1, 3}, {2017, 5, 15}}]

Out[10]= Missing["NotAvailable"]
47 Replies

Hi Sridev,

can you try this?

Entity["Financial", "NYSE:IBM"][EntityProperty["Financial", "Last", List[Rule["Date", Interval[List[DateObject[List[2005]], Today]]]]]]

Cheers,

Marco

Thank you Marco. This did give the price data. but I am not sure about other properties. I shall experiment.

one shortcoming is that the last data is as of 16may2017 whereas if FinancialData were working my last data point would have been 17may2017 when you run it on 18may2017.

I could see that the data using your syntax is coming from wolfram knowledgebase, whereas the FinancialData function perhaps downloads the data from a different source (perhaps a more Live source). maybe that source is broken? does anyone face similar problem or can anyone working in wolfram in the community comment?

Its like a key finance inbuilt function is not working. which is the best place to report this. sorry I have not done that before. Hence the question.

Hi,

it used to use Yahoo.

It is true that many of the examples in the documentation of FinancialData do currently not appear to work properly on my machine. (MMA 11.1.1, OSX 10.12.4)

Best wishes,

Marco

Marco, Do you know how to obtain from Mathematica a list of entities on in the S&P 500? I have a list in ticker format, e.g. "CAT", but not in the "NYSE:CAT" format.

Dear David,

are you looking for this?

EntityClass["Financial", "SP500"]

It gives you an entity list.

EntityList[EntityClass["Financial", "SP500"]]

appears to give all members.

Cheers,

Marco

Yes. Thank you!

This is true for me as well. FinancialData will return a current price if no date is specified. If a date or date range is specified it returns Missing. The missing issue started in the last day or two - it was working up to a few days ago. This has happened before.

I also have this problem. I assume there must be a problem on the Wolfram side of things???

I wonder if there is a way to report such issues to appropriate Wolfram staff?

Wolfram Alpha is working for me ... but ... it does not seem to provide Open, High, Low or Volume data.

I've reported this to tech support. However, the problem might be at the source rather than with Mathematica.

This is an issue with Yahoo as a data source.

Wolfram|Alpha doesn't use Yahoo, so it's not affected. You should try using Entities like the examples in the comments instead of using FinancialData.

Hi,

I have two observations:

  1. A couple of days ago there was a Paclet update, I think (http://community.wolfram.com/groups/-/m/t/1093145)

  2. I just used the Yahoo historical data api directly as described here. So basically I just execute:

    URLExecute["http://ichart.finance.yahoo.com/table.csv?s=IBM&a=11&b=15&c=2016&d=11&e=19&f=2016&g=11&ignore=.csv"]
    

This is the reply I get:

enter image description here

If that means what I think it means, it could be a temporary Yahoo glitch which might make this a temporary issue.

Cheers,

Marco

Update: having said that, on the website mentioned above there is a reply from 7 hours ago that says:

Hey everyone! Just to update this post a little bit: Historical API has been shut down by Yahoo Finance. Here is a link.

enter image description here

If that's true, it might be a longer term problem....

  1. Thanks Marco. His latest post shows what we feared that the api link with the live source(yahoo finance) is broken.
  2. Thanks David for reporting it to wolfram tech support. Pls let us know what you hear from them. I hope they hook the link to google finance or finviz or direct exchange delayed feed service or something like that.
  3. I think the alternative Marco's expression worked because it sources info from knowledgebase which gets data stored at a day's delay or something. And the original source for that could be several. so that's still getting data updated.
  4. Unless wolfram links up FinanacialData to a new feed, for the moment this function remains broken. even if it returns I am sure it will be a while perhaps till this finance function works in its full old vigour (with several ticker properties not just price that yahoo finance was providing). Lets see. Lets keep each other updated if we find alternative solutions or hear back from wolfram mathematica support.

Reply just received from tech support:

"Thank you for contacting Wolfram Technical Support. It does appear as though our FinancialData functionality is not behaving as one would expect. Upon investigation, it seems as though Yahoo Finance (where we get the data) is down at the moment (https://ichart.finance.yahoo.com/). We are working with them to resolve the issue as soon as possible."

They go on to suggest the same workaround used above by Marco.

Hey. I am new at this and not all that confident about suggesting anything but ...

I was poking around and came across

https://blog.quandl.com

They provide free data. Here are instructions on the API

https://blog.quandl.com/api-for-stock-data

I got joined and got an API key and this worked

https://www.quandl.com/api/v3/datasets/WIKI/FB/data.csv?api_key=MYAPIKEY

I know nothing of the data quality. I wonder, does this seem like a reasonable alternative?

In regards to

Have you guys seen this post? Financial data from Quandl in Wolfram Language using QuandlLink

I do not yet have any experience with packages. Does this work better than using variants of the URL for Quandl data?

https://www.quandl.com/api/v3/datasets/WIKI/FB/data.csv?api_key=MYAPIKEY

Is using that package worth the effort it might take (for me, at least) to make it work? Variants of

https://www.quandl.com/api/v3/datasets/WIKI/FB/data.csv?api_key=MYAPIKEY

seem fairly simple.

Posted 1 year ago

Edited for clarity and code:

Suitable quick solution. There is also a way to fully limit calls to Quandl data fields, ie, retrieve just date and adjusted close or whatever required. Anmol Bajracharya (QuandlLink author) posted a method using Dataset for filtering in the package documentation.

QuandlLink can be downloaded from https://github.com/bajracha71/Quandl-Mathematica-QuandlLink. Note FinancialData was never robust (vendor dependencies). It's certainly not the reason to use Mathematica in finance.

The following fragment retrieves the 1-year adjusted closing price for AAPL as example :

Needs["QuandlLink`"]

myquandlkey = "myquandlkey"; 
dataset = "datasets/WIKI/"; 
sym = "AAPL"; 
tstart = startDate -> DateString[DatePlus[Yesterday, {-1, "Year"}], 
         "ISODate"]; 
tend = endDate -> DateString[Yesterday, "ISODate"]; 
s = Reverse[Rest[QuandlFinancialData[StringJoin[dataset, sym], 
             apiKey -> myquandlkey, tstart, tend]]][[All, 12]]; 
s0 = Last[s]
POSTED BY: x64 '
Answer

I've also been struggling with this. I've tried using Marco's suggestion, but with limited success, for example, how do you get data for Facebook? NASDAQ:FB doesn't work.

This doesn't work for you?

DateListPlot[
 Entity["Financial", "NASDAQ:FB"]["Close", 
  "Date" -> Interval[{DateObject[{2005}], Today}]]]

enter image description here

Posted 1 year ago

I'm running 11.0.1 under Linux. Here's what I get:

DateListPlot[
  Entity["Financial", "NASDAQ:FB"]["Close", 
   "Date" -> Interval[{DateObject[{2005}], Today}]]];

DateListPlot::ldata: Missing[RetrievalFailure] is not a valid dataset or list of datasets.

FinancialData["NASDAQ:FB", "Lookup"]

{}

Many stocks work, but some do not (FB, SNAP, KHC for example)

Thanks, Joe

I found another way on the web to get ticker price data (even intraday is possible with this approach as unit of time is 1 sec. 1800=30minutes)

In[20]:= GetPriceData[stocksymbol_, exchangesymbol_, interval_, 
   numperiod_, parameters_] := 
  "http://www.google.com/finance/getprices?q=" <> 
   ToString[stocksymbol] <> "&x=" <> ToString[exchangesymbol] <> 
   "&i=" <> ToString[interval] <> "&p=" <> ToString[numperiod] <> 
   "&f=" <> ToString[parameters] <> "";

In[21]:= PriceData = 
  Import[GetPriceData["QQQ", "NASDAQ", "1800", "10d", "d,c"]];

In[22]:= PriceData[[9 ;; Length[PriceData], 2]]

Out[22]= {138.391, 138.52, 138.39, 138.395, 138.31, 138.385, 138.321, \
138.16, 138.26, 138.22, 138.245, 138.355, 138.32, 138.4, 138.11, \
137.97, 137.96, 138.255, 138.195, 138.26, 138.341, 138.36, 138.38, \
138.29, 138.37, 138.32, 138.4, 138.01, 137.635, 137.54, 137.54, \
137.7, 137.68, 137.84, 137.84, 137.97, 138.2, 138.26, 138.15, 138.15, \
138.29, 138.41, 138.38, 138.312, 138.34, 138.48, 138.6, 138.52, \
138.52, 138.5, 138.63, 138.53, 138.57, 138.441, 138.6, 138.64, \
138.91, 138.9, 139.06, 138.89, 138.79, 138.76, 138.77, 138.9, 138.97, \
138.81, 138.92, 138.94, 139.04, 139.38, 139.37, 139.06, 139.2, \
139.287, 139.39, 139.481, 139.47, 139.465, 139.395, 139.395, 139.4, \
139.46, 139.62, 138.53, 138.12, 137.99, 137.26, 137.4, 137.66, \
137.405, 137.64, 137.411, 137.16, 136.83, 136.71, 136.65, 136.07, \
136.05, 136.53, 137.19, 137.121, 137.22, 136.71, 136.879, 136.9, \
136.86, 137.23, 137.54, 137.33, 137.309, 137.26, 137.72, 138.04, \
138.19, 138.21, 138.14, 138.22, 138.26, 138.34, 138.29, 138.24, \
138.255, 138.26, 137.92, 137.825, 138.145, 138.58, 138.62, 138.55, \
138.69, 138.8, 138.886, 138.86, 138.86, 138.793, 138.87, 138.918, \
138.94, 139}
Posted 1 year ago

Hi Sridev, Thanks for the pointer! It looks like about 80 days is as far as you can look back (or am I confused?) Also, I can't figure out how to look up mutual funds.

-Joe

Posted 1 year ago

Please note that I'm still having issues today with

DateListPlot[
 Entity["Financial", "NASDAQ:FB"]["Close", 
  "Date" -> Interval[{DateObject[{2005}], Today}]]]

about 40 equities work, but the following fail as mentioned above (basically there is no data):

KHC, FB, FSRVX, MWEMX, MWTSX, SNAP.

Could it be the data server that I'm drawing from?? Is there a way to change servers?

Are you finding that financial data functions work for you now? (i.e. using FinancialData[])

Jeff Lapides

FinancialData appears to work again. i havent tried all the options and settings..For example, when i tried FinancialData["GE",{2016}], it gives daily data starting from jan 1, 2016 as expected. Thanks to wolfram team to make the function work again. it will be nice to know details of where they are sourcing it..(is yahoo api back on or is it a different source?)

thanks SR

The Yahoo! Finance API is still (permanently, as far as anyone knows) gone.

I'm glad it's meeting your needs right now — overall, FinancialData is in decent shape, but not as robust as we want it to be. We're in the process of switching it over to use WolframAlpha financial sources under the hood, and will announce when that transition is complete.

Are you finding that FinancialData works? I continue to have problems with it.

Jeff Lapides

daily price data from a start date to end date is what i normally use this function for. and it appears to work normally again since i posted that update on this thread earlier.....

Yahoo finance API is not available anymore. I have moved to MarketXLS after this change, much more reliable data.

Posted 11 months ago

Is it possible to download data directly into Mathematica using MarketXLS?

Posted 1 year ago
FinancialData[sym, "Close", startdate]

worked for the past few weeks, but is failing again as of yesterday.

agree. was failing 1 or 2 days ago...it seems to work ok today, if you want to check

Posted 1 year ago

Hi Sridev, Confirmed working today (July 14). Thanks so much for letting me know. This kind of functionality if why I purchased Mathematica. It is important to me to have access to this type of data without having to write my own scrapers, etc.

Joe:

Agreed. Seems to go in and out. Not working today, July 15.

Jeff

Yahoo finance API is not available anymore. I have moved to MarketXLS after this change, much more reliable data.

Posted 1 year ago

As of about July 17, FinancialData has been working fine for me. Thanks Wolfram (and Wolfram Community).

Posted 11 months ago

Bad news, for the past two weeks all historical queries (such as the following) return an empty list

FinancialData["FDSSX", "Close", {2017, 1, 1}]

Also some equities are not found.

I don't see the same:

In[33]:= FinancialData["FDSSX", "Close", {2017, 1, 1}][[;; 5]]
Out[33]= {{{2017, 1, 3}, 36.71}, {{2017, 1, 4}, 37.07}, {{2017, 1, 5}, 37.06}, {{2017, 1, 6}, 37.19}, {{2017, 1, 9}, 37.08}}

What version are you running, and does this problem persist if you quit your kernel and try again in a fresh one?

Just tried: FinancialData["FDSSX", "Close", {2017, 1, 1}] Got expected results.

I have not been monitoring for many months so I don't know what has been going on since my post.

Jeff

My question was directed at Joe Gilray, who was having trouble with that input earlier today. (Glad to hear it's working as expected for someone else, though.)

Posted 11 months ago

Hi Alan,

Yes, I'm still having the issue, even after restarting several times. I've tried everyday for about a week. I'm running 11.0.1.0 on Linux.

Note that I can do simple queries:

FinancialData["FDSSX"]
44.11

But that some equities that used to work fail, such as the Guggenheim S&P 500 fund:

FinancialData["RSP"]
Missing["NotAvailable"]

Thanks, Joe

Posted 11 months ago

I'm wondering if there are different servers out there. Last time FinancialData[] started having troubles, I noted that others seemed unaffected. Is there a way to figure out which server one is connected to?

Thanks, Joe

Posted 11 months ago

I'm really hoping for some help on this. Any thoughts or ideas out there? Thanks!

Joe: we recently switched FinancialData[] to use the same data sources as Wolfram|Alpha, and we're still working through some bugs related to that switchover.

For cases where a particular equity isn't recognized by symbol alone right now, you may have better luck with a more complete specification, incorporating the exchange. You've also helped us spot that the name of this fund is incorrect in our new database, which we're working to correct now (along with the failure to recognize the symbol on its own):

In[3]:= FinancialData["RSP"]
Out[3]= Missing["NotAvailable"]

In[1]:= FinancialData["NYSE:RSP"]
Out[1]= 97.49

In[2]:= FinancialData["NYSE:RSP", "Name"]
Out[2]= "Rydex S&P Equal Weight ETF"

If you find other issues, it would be even better if you would file a formal bug — it's easier for us to track problems that way.

Posted 11 months ago

Hi Alan, Thanks for the help. Now I can get the current price of all my equities, but I still can't get any historical prices. What is the best way to submit a bug report? Edit: I just used the web interface to support to issue a problem report. The case number is CASE:3974794.

Thanks again, Joe

Posted 10 months ago

The support folks at Wolfram have let me know that the issue is fixed in 11.1. They are working on fixes for earlier versions.

Has anyone ever had an issue with price daqta for individual stocks not matching price data for etf's?

startdates = {{2007, 1, 4},....}

enddates = {{2007, 4, 5},....}

Length[FinancialData["IWM", "Return", {startdates[[1]], enddates[[1]],  "Day"}, "Value"]]

Length[FinancialData["IBM",   "Return", {startdates[[1]], enddates[[1]], "Day"},   "Value"]]
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