Create a DataSet for entire market?
Author: joannakim
Creation Date: 6/6/2013 6:55 AM
profile picture

joannakim

#1
Hi. i used to get my data set of stock symbols from finviz.com and pasted into the new data set page of Wlp. But that has become more challenging since the format of finviz has changed. If I wanted to import the entire stock market minus some filtered out stocks, where and how would you get that? Thanks.
profile picture

Eugene

#2
Working example of getting all stocks from NYSE, NASDAQ and AMEX.

Install Community Components (or update to the latest and greatest), restart WLP. Give the script some time to complete its first time download and cache data on your disk. All subsequent strategy executions will be instant because of the cache.

The strategy will print out all stocks by exchange to Debug log. Your job is to copy each list to clipboard and paste into the New DataSet Wizard.

CODE:
Please log in to see this code.

profile picture

mlyon37

#3
Thanks this code was very useful. However, I was getting a compile error on this piece of code

CODE:
Please log in to see this code.

error CS1061 @ (30,7) 'Community.Components.Classification' does not contain a definition for 'Build' and no extension method 'Build' accepting a first argument of type of type 'Community.Components.Classification' could be found (are you missing a using directive or an assembly reference?)

I have installed the community components and the code works perfectly if you comment out that piece.
profile picture

Eugene

#4
In cases like this, please refer to the Wiki online guide:

Classification (U.S. stocks by Exchange)

There you'd learn that syntax of the Classification class had a breaking change (towards simplicity of use) in v2014.07, meaning that old code examples stopped working anymore. Please also find a new code example in the Wiki.

Hope that helps.
profile picture

mlyon37

#5
Thanks, combined it with another example to output the tickers to some .csv files

CODE:
Please log in to see this code.
profile picture

Eugene

#6
Sadly, the Classification class is broken by recent overhaul of nasdaq.com which was the source of the data. Due to no interest I'll remove the class from Community Components in v2019.12. As a silver lining, check out this fruitful discussion:

How to create DataSet out of Yahoo Classification Groups file?

If you're looking to find the components of AMEX, NASDAQ and NYSE then at the moment it gives you two alternatives, free and paid. Both not allowing for programmatic access, I'm afraid.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).