finvizfinance Documentation

repository·master·Indexed 23 days ago

https://github.com/lit26/finvizfinance

A Python package for scraping financial information from FinViz. It provides tools to retrieve stock fundamentals, technical data, financial statements, and insider trading information. Key features include a stock quote module for individual tickers, a screener for filtering stocks by criteria, and dedicated modules for Forex, Crypto, economic calendars, and financial news.

Tokens
3.2K
Snippets
17
Records
27
Agent score
81%

What's inside finvizfinance

  1. Get group information using finvizfinance.group

    master

    The finvizfinance.group module provides access to aggregated financial data categorized by groups. You can retrieve information across four main categories:

    • Overview: General group summary data.
    • Valuation: Metrics related to the valuation of companies within the group.
    • Performance: Historical and recent performance metrics for the group.
    • Spectrum: Data regarding the distribution or range of metrics within the group.

    Each category is implemented as a separate submodule within finvizfinance.group.

  2. Access screener data via finvizfinance

    master

    The finvizfinance library provides access to various categories of stock screener data. You can retrieve data by importing specific modules from finvizfinance.screener. The available data categories are:

    • Overview: General company overview data.
    • Valuation: Metrics related to company valuation (e.g., P/E ratios).
    • Financial: Fundamental financial data.
    • Ownership: Data regarding company ownership and insider holdings.
    • Performance: Historical and recent performance metrics.
    • Technical: Technical analysis indicators.
    • Ticker: Data associated with specific tickers.
  3. Get stock quotes and information

    master

    Use the finvizfinance class from finvizfinance.quote to instantiate a stock object by its ticker symbol. Once instantiated, you can download ticker charts or retrieve various fundamental and news data points.

    import pandas as pd
    from finvizfinance.quote import finvizfinance
    
    stock = finvizfinance('tsla')
    
    # Download chart to a directory
    stock.TickerCharts(out_dir='asset')
    
    # Get individual ticker information
    stock_fundament = stock.ticker_fundament()
    stock_description = stock.ticker_description()
    stock_peers = stock.ticker_peer()
    stock_etf_holders = stock.ticker_etf_holders()
    outer_ratings_df = stock.ticker_outer_ratings()
    news_df = stock.ticker_news()
    inside_trader_df = stock.ticker_inside_trader()
  4. Get stock quotes and fundamentals with finvizfinance

    master

    Use the finvizfinance class from finvizfinance.quote to fetch comprehensive data for a specific ticker. You can retrieve fundamental data, company descriptions, outer ratings, news, and insider trader information. The class also supports downloading ticker charts as image files.

    import pandas as pd
    from finvizfinance.quote import finvizfinance
    
    stock = finvizfinance('tsla')
    
    # Download chart image
    stock.ticker_charts()
    
    # Retrieve data
    stock_fundament = stock.ticker_fundament()
    stock_description = stock.ticker_description()
    outer_ratings_df = stock.ticker_outer_ratings()
    news_df = stock.ticker_news()
    inside_trader_df = stock.ticker_inside_trader()
    signal = stock.ticker_signal()
  5. Get insider trading information

    master

    Use the Insider class from finvizfinance.insider to retrieve insider trading data. You can specify the type of data via the option parameter (e.g., 'top owner trade') when initializing the class.

    from finvizfinance.insider import Insider
    
    finsider = Insider(option='top owner trade')
    finsider.get_insider().head()
  6. Get financial news

    master

    Use the News class from finvizfinance.news to fetch news articles. The get_news() method returns a dictionary containing news and blog data.

    from finvizfinance.news import News
    
    fnews = News()
    all_news = fnews.get_news()
    # Access news via all_news['news'] or blogs via all_news['blogs']
  7. Use the Screener to filter stocks

    master

    Use the Overview class from finvizfinance.screener.overview to filter stocks based on specific criteria. Use set_filter with a dictionary of filters and call screener_view() to retrieve the results as a DataFrame.

    from finvizfinance.screener.overview import Overview
    
    foverview = Overview()
    filters_dict = {'Exchange':'AMEX','Sector':'Basic Materials'}
    foverview.set_filter(filters_dict=filters_dict)
    df = foverview.screener_view()
    df.head()