Thursday, September 25th, 2008
You can download CSV for list of companies listed at AMEX (American Stock Exchange), NASDAQ (National Association of Securities Dealers Automated Quotations) and NYSE (New York Stock Exchange) from here.
FYI: Data is not clean and requires some deal of scripting before you can extract list of symbols from it. I’ll post more on this to make things better and handy.
Cheers,
Posted in Financial World | No Comments »
Thursday, September 25th, 2008
Here is a small program that can create list of companies listed at NYSE (New York Stock Exchange). I created the script to help a friend of mine who has a itch for “stock analysis”.
<?php
$files = range('A', 'Z');
$files[] = 'Other';
$curl = curl_init();
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
foreach ($files as $f) {
$url = "http://www.nyse.com/about/listed/lc_ny_name_${f}.js";
curl_setopt($curl, CURLOPT_URL, $url);
$content = curl_exec($curl);
// get symbol from JS
preg_match_all('%\[\"(\w*)\",%', $content, $matches);
foreach($matches[1] as $symbol) {
echo "$symbol\n";
}
}
?>
I’ll upload the complete list somewhere to make it more handy.
Cheers,
Posted in Financial World | No Comments »