Finviz Data Scrap for Python 3.6. This is my first non-academic related program that I have written to allow users to specifically draw data from Finviz's top gainers page, and export the data into a csv file. Do note that this API only works for scraping data on one page of Finviz's website.'Hope this is of use to some people out there.
You'll need the following dependencies:
- BeautifulSoup4
- Pandas
- Urllib
- Datetime
This API essentially allows you to get the stock data from finviz into a dataframe, and exports it to a csv file.
This API can be called in two different ways.
- Without an input e.g. 'scrap_finviz()'
There is a url that is hard coded in this function based on the top 20 stocks on http://finviz.com/screener.ashx Feel free to modify the filters on the website accordingly and you can simply copy the url.
- With a url input e.g. 'scrap_finviz('http://finviz.com/screener.ashx')
All the data is retrieved from http://finviz.com/screener.ashx