FinViz API¶
Fetch a FinViz Screener and Convert it to a List of Tickers¶
Supported Fetch calls
- Convert a FinViz Screener URL to a list of tickers.
-
analysis_engine.finviz.fetch_api.
fetch_tickers_from_screener
(url, columns=['ticker_id', 'ticker', 'company', 'sector', 'industry', 'country', 'market_cap', 'pe', 'price', 'change', 'volume'], as_json=False, soup_selector='td.screener-body-table-nw', label='fz-screen-converter')[source]¶ Convert all the tickers on a FinViz screener url to a
pandas.DataFrame
. Returns a dictionary with a ticker list and DataFrame or a json-serialized DataFrame in a string (by defaultas_json=False
will return apandas.DataFrame
if thereturned-dictionary['status'] == SUCCESS
Works with urls created on:
https://finviz.com/screener.ashx
import analysis_engine.finviz.fetch_api as fv url = ( 'https://finviz.com/screener.ashx?' 'v=111&' 'f=cap_midunder,exch_nyse,fa_div_o5,idx_sp500' '&ft=4') res = fv.fetch_tickers_from_screener(url=url) print(res)
Parameters: - url – FinViz screener url
- columns – ordered header column as a list of strings and corresponds to the header row from the FinViz screener table
- soup_selector –
bs4.BeautifulSoup.selector
string for pulling selected html data (by defaulttd.screener-body-table-nw
) - as_json – FinViz screener url
- label – log tracking label string