Sentiment-Analysis-in-Event-Driven-Stock-Price-Movement-Prediction icon indicating copy to clipboard operation
Sentiment-Analysis-in-Event-Driven-Stock-Price-Movement-Prediction copied to clipboard

all_tickers.py is stuck

Open dropcunt opened this issue 4 years ago • 6 comments

I think there is a problem with the urlib.request. Might need to add a header

dropcunt avatar Jan 26 '21 13:01 dropcunt

Hi @dropcunt, I got the same problem. Have you found a way to fix it?

tmhieu99 avatar May 01 '21 10:05 tmhieu99

Hi @tmhieu99 and @dropcunt, I stumbled upon the same problem and the solution is actually very easy. The exchange where the script is fetching the data from changed its routing, which is why it gets stuck. In all_tickers.py, you need to replace the part where you fetch the exchange data to this:

for exchange in ["NASDAQ", "NYSE", "AMEX"]:
    # this is the changed URL
    url = "https://api.nasdaq.com/api/screener/stocks?offset=0&exchange={}&download=true"

    repeat_times = 10
    
    for _ in range(repeat_times):
        response = urlopen(url.format(exchange))

I was then able to successfully download the tickers

dkubanyi avatar Jun 16 '21 12:06 dkubanyi

Hi @dkubanyi, tt worked now. Thanks for your solution.

tmhieu99 avatar Jun 16 '21 12:06 tmhieu99

@dkubanyi could you send the full code block? When I do this, it still does not work.

vedantk281007 avatar Sep 18 '22 16:09 vedantk281007