Joshua,

Thank you for your answer. It got me on the right track in a few minutes...
Thanks also to other people responded to the list or directley.

So I came up with a list of symbols which is an approximation of all traded
common stocks with the following code:
require(TTR)
symbols <- stockSymbols()
#head(symbols)
#write.csv2(symbols, file = "D:/test/symbols.csv")
#take only those without special charcters...
drop <- c(grep("\\^", symbols[, 1]),
    grep("\\/", symbols[, 1]),
    grep("\\:", symbols[, 1]),
    grep("\\-", symbols[, 1]),
    grep("Test", symbols[, 2]),
    grep("ETF", symbols[, 2]),
    grep("Trust", symbols[, 2]),
    grep("Fund", symbols[, 2]))
if(NROW(drop)!=0) {
 symbols_fixed <- symbols[-drop,]
}
write.csv2(symbols_fixed, file = "c:/temp/symbols_fixed.csv")

The problem left is that in the list I get with this code are still mutual
funds and ETFs and can not find a way how to filter them out. Is there a way
to filter those out to? Is there a list of ETFs and mutual funds symbols
available to download...

I also found these links in quantmod package in attachSymbols.R file
http://ftp.nasdaqtrader.com/dynamic/SymDir/nasdaqlisted.txt and
http://ftp.nasdaqtrader.com/dynamic/SymDir/otherlisted.txt . I am wondering
whether this is something stable (will be there for some time), where this
comes from etc.. Where can I find specification/description of columns in
this files?

When I get to final piece of code for calculating market breadth (or
something simmilar as Market Monitor from StockBee) i will share it with the
community.

Well, maybe the best thing is that I quit R for this specific task and buy
telechart for $299 where this list of all traded common stocks is available
with two clicks (with mutual funds and ETFs filtered out) and screeners
available/easy to write to get to this market breadth indicators... Another
possibility is to buy CSI data, I guess.

What would your advice be? Forget about developing it since you can get it
via Telechart for $299, buy data from CSI or simmilar and use that,...

Best regards,
Samo.


2011/4/15 Joshua Ulrich <josh.m.ulrich@gmail.com>

> On Thu, Apr 14, 2011 at 4:02 PM, Samo Pahor <samo.pahor@gmail.com> wrote:
> > Hello R Finance experts!
> >
> > I would like to calculate market breadth indicators using data from Yahoo
> (I
> > would use quantmod) or Interactive Brokers (using another great package
> > IBrokers). I would like to create something simmilar as Stockbee Market
> > Monitor
> >
> http://stockbee.blogspot.com/2010/08/understanding-market-monitor-part1.html
> > using
> > data from Yahoo or IB using R.
> >
> > First I need all the symbols/tickers of common stocks available for
> trading
> > from either Yahoo or IB on a particular day. How can I get the list of
> all
> > common stocks traded from this two sources?
> >
> I don't know of a way to get all common stocks from Yahoo, but the
> stockSymbols function in TTR will download AMEX, NYSE, and NASDAQ
> instrument symbols from nasdaq.com and tries to adjust the symbols to
> make the compatible with Yahoo Finance.
>
> Look at the source code of stockSymbols to see how it adjusts the
> ticker symbols.  This Yahoo web page will help you filter out the
> common stocks:
> http://help.yahoo.com/l/us/yahoo/finance/quotes/quote-02.html
>
> > Are there any market breadth indicators R code available in existing
> > packages? Is there any article/blog post showing how to approach data
> > collection from Yahoo or IB in order to calculate market breadth
> indicators?
> >
> There are a few I've planned to include in TTR.  They're generally
> very simple and I don't personally use breadth indicators, so adding
> them hasn't been a high priority.
>
> > Best regards,
> > Samo.
> >
> >        [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-SIG-Finance@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> > -- Subscriber-posting only. If you want to post, subscribe first.
> > -- Also note that this is not the r-help list where general R questions
> should go.
> >
>
> Best,
> --
> Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
>

	[[alternative HTML version deleted]]

