Getting FTSE and NASDAQ stock market details
Hi,
I'm new to getting info from a website and rendering it but have been asked by a potential employer to create such a feature on a website. What would be useful is if someone could point me in the right direction and possibly some scripts to look at?
Cheers.
Re: Getting FTSE and NASDAQ stock market details
Try getting it from yahoo loads has files with up to 500 lines in them like...
3IN.L
888.L
AAIF.L
Prices are 15 minutes delayed, live prices are expensive! if you just want to look at the for free have a look at Shareprice
Code:
#!/bin/bash
# Copyright James Hawtin <oolon at NO ankh SPAM org PLEASE > 2009
# All rights reserved
PATH=/usr/local/bin:/usr/bin:/bin
HM=/home/oolon
PREFIX=stocks
LOAD="true"
cd $HM/$PREFIX/stocks/daily/yahoo/loads
for i in *
do
cd $HM/$PREFIX/stocks/daily/yahoo
multistocks=`cat loads/$i | while read a; do echo "$a+"; done | xargs echo | sed -e "sq qqg" | sed -e "sq+\\\$qq"`
# wget "http://uk.old.finance.yahoo.com/d/quotes.csv?s=$allstocks&f=sl1d1t1c1ohgv&e=.csv"
# wget "http://finance.yahoo.com/d/quotes.csv?s=$allstocks&f=sl1d1t1c1ohgv&e=.csv"
FILE=`date +%Y%m%d-$i.csv`
URL="http://uk.old.finance.yahoo.com/d/quotes.csv?s=$multistocks&f=sl1d1t1c1ohgv&e=.csv"
curl $URL > $FILE
sleep 5
done
$HM/$PREFIX/script/daily_loaddata.sh
Re: Getting FTSE and NASDAQ stock market details
Hi oolon,
Thanks for the info in your reply and code, but what I've been asked for is the ability to enter a stock symbol and to retrieve the FTSE and NASDAQ data for that company. This is what I'm struggling with as I've never done this before and also never had to get data from another website and render it in my own website so this is what I'm looking to get guidance in.
Originally I had a WordPress blog with a Yahoo stocks widget but the widget takes you to Yahoo's website when you enter a stock symbol, but what the person wants is for it to be done all on my website (including displaying of a company's stock market data such as current share price etc)
Cheers.
Re: Getting FTSE and NASDAQ stock market details
What you need to use is what I have shown a simple example for above, the Yahoo stocks API have a read here. Unless you cache things, (yahoo have a rate limiter that will lock you out for 2 days). You need to so some user side scripting so their computer pulls the information.
Re: Getting FTSE and NASDAQ stock market details
Cheers. I will have a look.