|
|
Sooty's Table of Foreign Stocks on American Stock Exchanges
| |
Note: On January 17, 2017 Yahoo changed their financial pages so most of the interesting information
is hidden inside Javascript code. The remaining html content that can be scraped from Yahoo pages
may be useful to "momentum traders" (like AverageDailyVolume10Day) but items that "value investors" need
(like number of shares outstanding) are not available to an html content fetch.
The good news is that PhantomJS) is able to run the target website javascript
and return the result as html content. The javascript content (what you'd see in a popular browser) is exactly what
and investor wants to see. The not so good news is the fetch overhead is very high. A simple Java fetch takes 0.25 elapsed
seconds and 0.002 compute seconds page (single 3Ghz core). A PhantomJS fetch takes 13 elapsed seconds
(resourceTimeout=5 seconds) and 0.030 compute seconds per page...so 50 times longer with a 15 times bigger hit on the CPU.
With 6000 "interesting" stocks (AMEX+Nasdaq+NYSE) to download: PhantomJS needs is 22 hours to fetch and cache.
The process is already segemented and only does 1/5 of the stocks per day (to keep from being banned by Yahoo).
Even with this throttle it will take over 4 hours to refresh my local cache.
With the use of Javascript growing there is little choice. Sooty is now rewriting the parsers to use PhantomJS provided
content (other tools may have a differnet layout). After that Sooty will pull apart the PhantomJS sources looking
for a faster subset or try another approach.
If this is your first time here please read the explanation
on why these stocks were selected. You should understand that Sooty is
a "value investor" with a "buy and hold" strategy who is only interested
in income generating stocks and bonds. If you are a day trader with technical
strategy looking for momentum or short plays you will find Sooty's strategy
boring. You may still be interested in the three spreadsheets on this page that
include all stocks listed on the NASDAQ, NYSE and AMEX exchanges including over 50
columns of stock performance and profile data.
The following is a list of candidates for your investigation. Once again
Sooty is NOT recommending you buy these (nor does Sooty expect a cut if
you make a lot of money on them). Foreign stocks represent less than 10%
of the stocks on the American exchanges but if you are Canadian and interested
in tax sheltered investments that will not suffer a $US currency risk these are about all you get.
There is a tax agreement between Canada and the USA so that American stocks
held in Canadian pension instruments (RRSPs, RIFs and LIFs) are not taxed
at the source nor are Canadian stocks held in 401Ks. Exchanges in other
countries will require you pay a withholding tax and file a tax return
to recover this tax. Non-pension investments by Canadians (like TFSAs)
will suffer a withholding tax and you will have to file a US return to
get (some) of your money back.
The stocks are listed are the top foreign stocks with the highest income/price ratio
listed on each of the exchanges. The table is limited to the top 20 stocks and one
should be skeptical of stocks with yields over 20% because there is either something
wrong with the data or the company. If you go to the CSV you will see all the stocks.
Clicking the column header will sort by that column. A short comment about
the column will appear if you move the mouse over a column header.
NASDAQ Stock Exchange
NYSE Stock Exchange
AMEX Stock Exchange
These tables were last updated .
A CSV spreadsheet of companies with more detailed information is available at these links:
NASDAQ stocks
NYSE stocks
AMEX stocks
How the Table was Created - a Programmers View
To acquire, convert, reconcile and store the information to support this
site is a fairly involved process. It would be nice if standards for the
semantic web were in place and Sooty's computers could talk directly to
the information sources. I am sure one could purchase an information feed
in XML format but that would violate the rule that one should not pay for
advice on public information. Besides it is a lot more interesting to build
the robots that scrape the websites, tinker with the parsers that strip
out the data from the html, and design the database and analysis programs
that find information on the listed stocks.
Sooty does not have time to do the work by hand so the whole process is
automated:
- At 8:00 PM Pacific Time a Java robot scrapes www.nasdaq.com for a directory of listed stocks
on NASDAQ, NYSE and AMEX exchanges.
- A Java database program reads the NASDAQ, NYSE and AMEX directories
and using PhantomJS extracts performance information from the "Key Statistics" pages
at finance.yahoo.com it loads roughly 70 performance measures into a
MySQL database.
- A Java reporting program reads the MySQL database and
creates Comma Separated Value (CSV) extracts with all the available
performance values. It also selects the 10 highest yielding foreign
income stocks to display and writes the JavaScript code that makes the
tables on this page work.
- A CSV or each exchange and three JavaScript code fragments are uploaded to this page.
The database programs and the web upload only take a few minutes each but every weekday 1/5 of the 8,000 company pages
from Yahoo are copied into a cache (about 4 hours...PhantomJS is slow...but the only open source product that works).
The extraction programs work off the local cache to the keep the hit on Yahoo as light as possible.
The rest of the processing process completes
in about 20 minutes.
|