mariostoev/finviz

Not getting full results list using the screener

Closed this issue · 5 comments

Hi, I'm trying to use this module to pull all tickers for the NYSE and am running into an issue where I cannot access all the results returned. I have the code below setup to query finviz and get a result set back. It appears to have the right number of results at first, len(stock_list_nyse) returns the same number I see on finviz, but when I try to export to CSV or loop through and print each result I only get between 100 and 160 results (it varies each time). Any ideas what's causing this? Do I need finviz elite in order to see more results?

filters = ['exch_nyse']  
stock_list_nyse = Screener(filters=filters, table='Overview', order='Ticker') 

stock_list_nyse.to_csv("stock_list_nyse.csv")

print('Results: ', len(stock_list_nyse))
i = 0
for stock in stock_list_nyse:  # Loop through 10th - 20th stocks
    i = i+1
    print(i, ' - ', stock['Ticker'],' - ', stock['Sector']) 
d3an commented

Try this one: pip install -U git+https://github.com/mariostoev/finviz

I did this - seems to work but the request takes about a minute or two (much longer than it used to be)

d3an commented

@parker-moore FinViz put a rate limiter on requests. Each request returns 20 stocks. Wait times between requests are set to 0.5 seconds, otherwise stocks will be missing in the final results. Depending on how many stocks your screen returns you can roughly calculate the time it takes to finish. You could decrease the wait times, but it might fail if less than 0.3-0.5s.

Yeah I'm having the same issue and I just installed finviz via 'pip install -U git+https://github.com/mariostoev/finviz'

UPDATE: I had to repoint my PyCharm to a different virtual environment in order to make the new finviz installation stick. It's working fine now, so please disregard.

worked for me as well, although after the new pip install, when trying to call the screener i encountered the following error:
"TypeError: __init__() missing 1 required keyword-only argument: 'css_select'"

it's probably related to my python version (3.8.5),
I had to explicitly add parameter css_select=False in line 335 of screener.py, and then it worked as expected.

Changed this:
async_connector = Connector(scrape.download_chart_image, chart_urls)
To this:
async_connector = Connector(scrape.download_chart_image, chart_urls, css_select=False)