2

I want to display on a wordpress page the total volume of shares traded on the NYSE stock exchange the last 2 weeks that it's been open. What is the best way to go about doing this?

Charles Stewart
  • 11,661
  • 4
  • 46
  • 85
pg.
  • 2,503
  • 4
  • 42
  • 67

3 Answers3

2

Yahoo Finance lets you export their data. For a ticker, on the left sidebar there is a link to Historical Prices. On the bottom of that page there is a link "Download To Spreadsheet".

You could pass that to fgetcsv to parse it.

Alex L
  • 8,419
  • 6
  • 43
  • 51
1

Scraping websites for data is generally seen as unethical, depending on your intentions and the frequency of the scrape. The bandwidth isn't free, you know. Instead, you should hopefully be able to find a data feed which has been designed to be consumed by other sites, such as yours.

Not knowing very much about your domain, I wouldn't really know what to search for, but here's some guesses:

nickf
  • 537,072
  • 198
  • 649
  • 721
  • Not to mention that content worth scraping is generally owned by another party and republishing it may well violate another party's rights. Check the legal section of any website you consider scraping or contact the owner. – Eric J. Nov 14 '09 at 00:25
  • I guess it's analogous to saying the score of a game after the game is over. I hadn't considered the legal/ethical issues too much. Yahoo seems to encourage the use of that kind of thing with their pipes. – pg. Nov 14 '09 at 00:34
1

Yahoo would be your best bet as they have an unofficial api documented here:

http://www.gummy-stuff.org/Yahoo-data.htm

Tons of apps/widgets rely on this so I can't see it going away

It has in fact gone away, due to yahoo asking that it be taken down.

From first glance, this url would give you what you need: http://finance.yahoo.com/d/quotes.csv?s=^NYA&f=v

Community
  • 1
  • 1
Ravi
  • 625
  • 1
  • 6
  • 19
  • actually I can't see a format argument for giving you volume so @Alex L's answer is probably better – Ravi Nov 14 '09 at 00:23