mariostoev/finviz

Is there a way to only print the 'Ticker' column to a CSV

Opened this issue · 1 comments

Since your Finviz data list seems to behave differently than a regular python list I am running into issues just printing a list of tickers based on a request.

This is what I'm trying to do:

from finviz.screener import Screener
import nest_asyncio
nest_asyncio.apply()

filter = ["geo_usa", "sh_avgvol_o2000", "sh_opt_optionshort", "sh_price_o30"]
stock_list = Screener(filters=filter, order='volume')
print ("%s symbols listed.\n" % len(stock_list))
tickers = stock_list['Ticker']
tickers.to_csv("tickers.csv")

The last one is breaking and I don't see any pertinent documentation about it telling me how to just grab one column.

Thanks in advance for any pointers.

Might not be the cleanest way, but you could do this.

tickers = [stock["Ticker"] for stock in stock_list]