mariostoev/finviz

RuntimeError: There is no current event loop in thread 'Thread-X'.

Closed this issue · 1 comments

Today I got RuntimeError at There is no current event loop in thread 'Thread-X' while trying this library in a Django based hobby project. I tried the below example:

from finviz.screener import Screener

filters = ['exch_nasd', 'idx_sp500'] # Shows companies in NASDAQ which are in the S&P500
stock_list = Screener(filters=filters, table='Performance', order='price')

OS: Ubuntu 20.10
Python: 3.8.6
Django: 3.1.2

Any idea of how to solve the issue?

I'm not entirely sure on what the issue is with the screener, but a workaround, for now, would maybe be write a separate function in a separate python file that runs everyday or whatever interval you set and the output is written to a csv or txt file that is then read when you display your views in django.