Skip to main content

Screen stocks on FinViz and scrape the data into dataframe.

Project description

Finscreen

Simple module that screens stocks on FinViz and scrapes the data into dataframe.

Usage

The module can scrape the data from overview, valuation, financial and technical tabs, based on desired filters, orders and range. The data then could be used to extract the tickers list or various stock indicators, such as stock's ROI or RSI. Which in-turn creates a convienient way to pick stocks based on desired criteria and use this data in more complex projects.

Installation

Install the package via pip:

pip install finscreen

Get Started

FinScreen has the following functions that return a Pandas DataFrame:

1. get_overview
2. get_valuation
3. get_financials
4. get_technicals

Functions arguments

Each of the functions have the same 3 arguments that have the following usage:

filter (string): Configure desired filter on Finviz website and paste the string after 'f=' from URL. Leave empty if needed.
order (string): Click on desired order on Finviz Table and paste the string after 'o=' from URL. Defaults to tickers in alphabetical order.
rg (integer): Desired range of scraping. To get all results navigate to the last table and paste the integer from URL. ; Defaults to 100.

Examples

Exporting data to Excel:

import os
import finscreen

# Creating folder for data
dir_path = os.getcwd() # Selects current working directory of a process
new_path = f"{dir_path}/finviz_data" 

if not os.path.exists(new_path):
    os.makedirs(new_path)

# Setting up arguments
filter = 'cap_largeover' # FinViz filter configured to screen companies with market capitalization of $10bln+
rg = 1000 # Screens first 1000 stocks
order = 'industry' # Stocks ordered by industry in alphabetical order

# Assigning data to dataframes
overview = finscreen.get_overview(filter = filter, order = order, rg = rg)
valuation = finscreen.get_valuation(filter = filter, order = order, rg = rg)
financial = finscreen.get_financials(filter = filter, order = order, rg = rg)
technical = finscreen.get_technicals(filter = filter, order = order, rg = rg)

# Exporting data to Excel
try:
    overview.to_excel(new_path+'/overview.xlsx')
    valuation.to_excel(new_path+'/valuation.xlsx')
    financial.to_excel(new_path+'/financial.xlsx')
    technical.to_excel(new_path+'/technical.xlsx')
except Exception:
    pass

Extracting tickers into a list and downloading their price/volume data using yfinance module:

from finscreen import get_overview
import yfinance as yf

df = get_overview(filter = 'fa_div_pos,fa_epsyoy_o15') # Screening first 100 stocks that have positive dividend yield and EPS growth in the current year of over 15%.

tickers_list = df.index.to_list()

universe = yf.download(tickers_list, 
                       period = '5y',
                       interval = '1d',
                       threads = True,
                       )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

finscreen-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

finscreen-0.1.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file finscreen-0.1.1.tar.gz.

File metadata

  • Download URL: finscreen-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for finscreen-0.1.1.tar.gz
Algorithm Hash digest
SHA256 324dbeb0496d321837d419bd9c182374337b68441228f2bb54212a5cf51abc6c
MD5 e33db2ea7ae41580a5cb84f5a1cd9db2
BLAKE2b-256 65a4b2db6480101592f5d123fa05fe5e47dbf2a556b5420332f2104d266fe0d6

See more details on using hashes here.

File details

Details for the file finscreen-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: finscreen-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.7

File hashes

Hashes for finscreen-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 925ee3e18a6390758094293761f529cbaf939d25b2c6793739274687a7c59bab
MD5 3b29cf789e119041ddd18100018c0d31
BLAKE2b-256 58a00f636294a23f70dd04f8fdbd697daccf04fb888f1ea9cd980df72b716042

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page