### Install finvizfinance Package Source: https://github.com/lit26/finvizfinance/blob/master/README.md Instructions for cloning the repository from GitHub or installing the package from PyPI. ```bash git clone https://github.com/lit26/finvizfinance.git ``` ```bash pip install finvizfinance ``` -------------------------------- ### Get Forex Performance Data using FinvizFinance Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb This example demonstrates how to retrieve performance data for various forex currency pairs. It utilizes the `Forex` class from the `finvizfinance.forex` module and calls the `performance` method to get a DataFrame containing price and performance metrics over different time intervals (5 min, hour, day, week, month). ```python from finvizfinance.forex import Forex fforex = Forex() df = fforex.performance() df ``` -------------------------------- ### Install Finviz Finance Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/index.md Instructions to set up a virtual environment and install the finvizfinance package via pip. ```bash virtualenv -p python3 virtualenvironment source virtualenvironment/bin/activate pip install finvizfinance ``` -------------------------------- ### Install Finvizfinance Source: https://context7.com/lit26/finvizfinance/llms.txt Install the library via pip to access financial data tools. ```bash pip install finvizfinance ``` -------------------------------- ### Initialize FinvizFinance and Get Chart URL Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Initializes the FinvizFinance object for a specific stock ticker and retrieves the URL for its chart. This is useful for visualizing stock performance. ```python import pandas as pd from finvizfinance.quote import finvizfinance stock = finvizfinance('tsla') chart_url = stock.ticker_charts() print(chart_url) ``` -------------------------------- ### Retrieve Earnings Data by Partition Date with Finvizfinance Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb This example demonstrates using the Earnings module from finvizfinance to fetch financial data partitioned by specific dates. It initializes the Earnings object and uses the partition_days method with the 'financial' mode. The result is a dictionary where keys are dates and values are pandas DataFrames containing earnings information. ```python from finvizfinance.earnings import Earnings fEarnings = Earnings() df_days = fEarnings.partition_days(mode='financial') df_days['Dec 06/a'] ``` -------------------------------- ### GET /news Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves the latest market news and blog posts from financial sources. ```APIDOC ## GET /news ### Description Retrieves current market news headlines, sources, and links. ### Method GET ### Endpoint /news ### Parameters None ### Request Example GET /news ### Response #### Success Response (200) - **news** (object) - Contains lists of news articles with Date, Title, Source, and Link. - **blogs** (object) - Contains lists of blog posts with Date, Title, Source, and Link. #### Response Example { "news": {"Date": "05:57PM", "Title": "Can Peloton Sue...", "Source": "www.nytimes.com"}, "blogs": {"Date": "07:30PM", "Title": "California Is Hiding...", "Source": "www.zerohedge.com"} } ``` -------------------------------- ### GET /screener/view Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/screener.md Retrieves the stock screener table based on current filter settings. ```APIDOC ## GET /screener/view ### Description Fetches the stock screener table from the specified category (Overview, Valuation, Financial, or Ownership). Allows sorting, limiting results, and pagination. ### Method GET ### Endpoint /screener/{category}/screener_view ### Parameters #### Query Parameters - **order** (str) - Optional - Sort column for the table (default: 'Ticker') - **limit** (int) - Optional - Maximum number of rows to return - **select_page** (int) - Optional - Specific page number to retrieve - **ascend** (bool) - Optional - Sort direction (True for ascending) ### Response #### Success Response (200) - **data** (pandas.DataFrame) - A dataframe containing the requested screener data. #### Response Example { "data": "[DataFrame object with columns: Ticker, Company, Sector, etc.]" } ``` -------------------------------- ### Get Cryptocurrency Performance Data Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb This code retrieves the performance data for various cryptocurrencies using the FinvizFinance library's crypto module. It initializes the Crypto class and calls the 'performance' method to get a DataFrame containing ticker, price, and performance metrics over different time periods. ```python from finvizfinance.crypto import Crypto fcrypto = Crypto() df = fcrypto.performance() df ``` -------------------------------- ### Get Earnings Data by Partitioned Days Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves earnings data partitioned by specific days using the Earnings module. ```APIDOC ## Get Earnings Data by Partitioned Days ### Description Retrieves earnings data partitioned by specific days using the Earnings module. The `partition_days` method can be used to fetch data for a given financial mode. ### Method ```python from finvizfinance.earnings import Earnings fEarnings = Earnings() df_days = fEarnings.partition_days(mode='financial') ``` ### Accessing Specific Day Data To access data for a specific day, you can index the resulting DataFrame. ```python df_days['Dec 06/a'] ``` ### Response Example (for 'Dec 06/a') ```json { "Ticker": "COUP", "Market Cap": "1.196000e+10", "Dividend": null, "ROA": "-0.109", "ROE": "-0.368", "ROI": "-0.04", "Curr R": "0.8", "Quick R": "0.8", "LTDebt/Eq": "0.97", "Debt/Eq": "1.63", "Gross M": "0.55", "Oper M": "-0.4", "Profit M": "-0.489", "Earnings": "Dec 06/a", "Price": "155.49", "Change": "-0.0444", "Volume": "1900530.0" } ``` ``` -------------------------------- ### Cryptocurrency Performance and Charting Source: https://context7.com/lit26/finvizfinance/llms.txt Fetch cryptocurrency performance data and download or get URLs for crypto charts. Supports timeframes '5M', 'H', 'D', 'W', 'M'. ```python from finvizfinance.crypto import Crypto fcrypto = Crypto() # Get crypto performance table df = fcrypto.performance() # Columns: Ticker, Price, Perf 5Min, Perf Hour, Perf Day, Perf Week, ... # Download Bitcoin chart (daily timeframe) chart_url = fcrypto.chart('BTCUSD', timeframe='D') # Get chart URL without downloading chart_url = fcrypto.chart('ETHUSD', timeframe='H', urlonly=True) # Timeframe options: '5M', 'H', 'D', 'W', 'M' ``` -------------------------------- ### GET /group/overview Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves an overview of market groups such as Industry, Sector, or Country. ```APIDOC ## GET /group/overview ### Description Retrieves a screener view of market groups, providing data on stock counts, market capitalization, dividends, and volume. ### Method GET ### Endpoint /group/overview ### Parameters #### Query Parameters - **group** (string) - Required - The grouping category (e.g., 'Industry', 'Sector') ### Response #### Success Response (200) - **Name** (string) - Group name - **Stocks** (int) - Number of stocks in the group - **Market Cap** (float) - Total market capitalization - **Volume** (float) - Trading volume #### Response Example { "Name": "Waste Management", "Stocks": 21, "Market Cap": 188240000000.0 } ``` -------------------------------- ### GET /forex/performance Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves the performance metrics for various forex pairs across different timeframes. ```APIDOC ## GET /forex/performance ### Description Returns performance data for forex pairs including 5-minute, hourly, daily, and weekly changes. ### Method GET ### Endpoint /forex/performance ### Response #### Success Response (200) - **Ticker** (string) - Forex pair symbol - **Price** (float) - Current rate - **Perf Day** (float) - Daily performance percentage #### Response Example { "Ticker": "BTCUSD", "Price": 49390.75, "Perf Day": 0.0160 } ``` -------------------------------- ### Forex Performance and Charting Source: https://context7.com/lit26/finvizfinance/llms.txt Retrieve forex performance data in PIPS and download or get URLs for forex charts. Supports various timeframes like '5M', 'H', 'D', 'W', 'M'. ```python from finvizfinance.forex import Forex fforex = Forex() # Get performance in PIPS instead of percent df = fforex.performance(change='PIPS') # Download forex chart chart_url = fforex.chart('EURUSD', timeframe='D') # Saves chart as image file # Get chart URL only chart_url = fforex.chart('AUDUSD', timeframe='H', urlonly=True) # Timeframe options: '5M', 'H' (hourly), 'D' (daily), 'W' (weekly), 'M' (monthly) ``` -------------------------------- ### GET /group/valuation Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves valuation metrics for specific market groups. ```APIDOC ## GET /group/valuation ### Description Provides detailed valuation metrics for market groups, including P/E ratios, PEG, P/S, and EPS growth projections. ### Method GET ### Endpoint /group/valuation ### Parameters #### Query Parameters - **group** (string) - Required - The grouping category (e.g., 'Industry') ### Response #### Success Response (200) - **Name** (string) - Group name - **P/E** (float) - Price to Earnings ratio - **Fwd P/E** (float) - Forward Price to Earnings ratio - **PEG** (float) - Price/Earnings-to-Growth ratio #### Response Example { "Name": "Utilities - Regulated Electric", "P/E": 25.24, "Fwd P/E": 1.91 } ``` -------------------------------- ### GET /crypto/performance Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves the performance metrics for various cryptocurrencies across different timeframes. ```APIDOC ## GET /crypto/performance ### Description Fetches a performance report for cryptocurrencies, including metrics like 5-minute, hourly, daily, weekly, monthly, quarterly, half-yearly, yearly, and YTD performance. ### Method GET ### Endpoint /crypto/performance ### Response #### Success Response (200) - **Ticker** (string) - Cryptocurrency symbol - **Price** (float) - Current market price - **Perf [Timeframe]** (float) - Performance percentage for the specified timeframe #### Response Example { "Ticker": "BTCUSD", "Price": 49411.74, "Perf Day": 0.0165 } ``` -------------------------------- ### Get Individual Stock Quote Information Source: https://github.com/lit26/finvizfinance/blob/master/README.md Retrieve fundamental, descriptive, news, and insider trading information for a specific stock ticker using the finvizfinance quote module. This involves initializing the finvizfinance object with a ticker symbol and then calling specific methods to get different types of data. ```python from finvizfinance.quote import finvizfinance stock = finvizfinance('tsla') ``` ```python stock_fundament = stock.ticker_fundament() # Example output: # stock_fundament = {'Company': 'Tesla, Inc.', 'Sector': 'Consumer Cyclical', # 'Industry': 'Auto Manufacturers', 'Country': 'USA', 'Index': '-', 'P/E': '849.57', # 'EPS (ttm)': '1.94', 'Insider Own': '0.10%', 'Shs Outstand': '186.00M', # 'Perf Week': '13.63%', 'Market Cap': '302.10B', 'Forward P/E': '106.17', # ...} ``` ```python stock_description = stock.ticker_description() # Example output: # stock_description = 'Tesla, Inc. designs, develops, manufactures, ...' ``` ```python stock_peer = stock.ticker_peer() # Example output: # stock_peer = ['LI', 'XPEV', 'NIO', 'RIVN', 'LCID', 'TM', 'HMC', 'GM', 'STLA', 'F'] ``` ```python stock_etf_holders = stock.ticker_etf_holders() # Example output: # stock_etf_holders = ['VTI', 'VOO', 'IVV', 'SPY', 'VUG', 'QQQ', 'VGT', 'IWF', 'XLK', 'SPLG'] ``` ```python outer_ratings_df = stock.ticker_outer_ratings() ``` ```python news_df = stock.ticker_news() ``` ```python inside_trader_df = stock.ticker_inside_trader() ``` ```python stock.ticker_charts() ``` -------------------------------- ### GET /screener/view Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/screener.md Retrieves the full screener table based on current filter settings with sorting and pagination options. ```APIDOC ## GET /screener/view ### Description Get the full screener table with optional sorting, pagination, and column selection. ### Method GET ### Endpoint /screener/view ### Parameters #### Query Parameters - **order** (str) - Optional - Sort the table by the choice of order - **limit** (int) - Optional - Set the top k rows of the screener - **select_page** (int) - Optional - Set the page of the screener - **ascend** (bool) - Optional - If True, the order is ascending - **sleep_sec** (int) - Optional - Sleep seconds for fetching each page ### Response #### Success Response (200) - **data** (pandas.DataFrame) - Screener information table ``` -------------------------------- ### Get Real-time Stock Price Source: https://context7.com/lit26/finvizfinance/llms.txt Retrieve the current real-time price for a given ticker symbol. ```python from finvizfinance.quote import Quote quote = Quote() price = quote.get_current('AAPL') ``` -------------------------------- ### GET /screener/compare Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/screener.md Retrieves a screener table comparing a specific ticker against a list of properties like Sector, Industry, or Country. ```APIDOC ## GET /screener/compare ### Description Get screener table of similar property (Sector, Industry, Country) for a given ticker. ### Method GET ### Endpoint /screener/compare ### Parameters #### Query Parameters - **ticker** (str) - Required - The ticker to compare - **compare_list** (list) - Required - Choice of compare property (Sector, Industry, Country) or combination - **order** (str) - Optional - Sort the table by the choice of order - **verbose** (int) - Optional - Choice of visual the progress (1 for visualize) ### Response #### Success Response (200) - **data** (pandas.DataFrame) - Screener information table ``` -------------------------------- ### Get Economic Calendar Data Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/calendar.md Retrieves the economic calendar data as a pandas DataFrame. ```APIDOC ## GET /calendar ### Description Retrieves the economic calendar table from Finviz. ### Method GET ### Endpoint /calendar ### Parameters None ### Request Body None ### Request Example None ### Response #### Success Response (200) - **economic_calendar** (pandas.DataFrame) - The economic calendar data. #### Response Example ```json { "economic_calendar": "[pandas.DataFrame content]" } ``` ``` -------------------------------- ### Get Financial Statements - Python Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Fetches financial statements for a specified stock ticker. Users can select statement type (e.g., 'B' for Balance Sheet) and timeframe (e.g., 'Q' for Quarterly). ```python from finvizfinance.quote import Statements statement = Statements() df = statement.get_statements('AAPL', statement="B", timeframe="Q") df.head() ``` -------------------------------- ### Get Screener Stocks Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/screener.md Fetches a list of stocks from the screener based on specified sorting and filtering criteria. ```APIDOC ## screener_view(order='Ticker', limit=-1, verbose=1, ascend=True, sleep_sec=1) ### Description Get screener stocks. ### Parameters #### Query Parameters - **order** (str) - Optional - The property to sort the stock list by. Defaults to 'Ticker'. - **limit** (int) - Optional - The maximum number of stocks to return. Defaults to -1 (no limit). - **verbose** (int) - Optional - Controls the visualization of progress. 1 to visualize progress. Defaults to 1. - **ascend** (bool) - Optional - If True, the order is ascending. Defaults to True. - **sleep_sec** (int) - Optional - The number of seconds to sleep between fetching each page of results. Defaults to 1. ### Response #### Success Response (200) - **tickers** (list) - A list of ticker symbols. ``` -------------------------------- ### GET /company/info Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves detailed financial and market information for a specific company using its ticker symbol. ```APIDOC ## GET /company/info ### Description Get comprehensive market data for a single company by ticker. ### Method GET ### Endpoint /company/info ### Parameters #### Query Parameters - **ticker** (string) - Required - The stock ticker symbol (e.g., 'TSLA') ### Request Example { "ticker": "TSLA" } ### Response #### Success Response (200) - **Ticker** (string) - Stock symbol - **Market Cap** (float) - Total market capitalization - **P/E** (float) - Price-to-earnings ratio - **Price** (float) - Current price #### Response Example { "Ticker": "TSLA", "Market Cap": 979740000000, "Price": 1017.03 } ``` -------------------------------- ### GET /insider Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves insider trading activity data based on specific filtering options. ```APIDOC ## GET /insider ### Description Fetches insider trading reports, including transactions, relationship, and SEC Form 4 links. ### Method GET ### Endpoint /insider ### Parameters #### Query Parameters - **option** (string) - Required - Filter type, e.g., 'top owner trade'. ### Request Example GET /insider?option=top+owner+trade ### Response #### Success Response (200) - **data** (dataframe) - Returns a table of insider trading transactions. #### Response Example { "Insider Trading": "Musk Elon", "Relationship": "CEO", "Transaction": "Sale", "Value ($)": 408039939.0 } ``` -------------------------------- ### Get Recent Financial News Source: https://github.com/lit26/finvizfinance/blob/master/README.md Fetch recent financial news and blog posts from FinViz using the finvizfinance news module. This involves initializing the News object and calling the get_news method. ```python from finvizfinance.news import News fnews = News() all_news = fnews.get_news() ``` ```python all_news['news'].head() all_news['blogs'].head() ``` -------------------------------- ### Use Screener for Stock Data Filtering Source: https://github.com/lit26/finvizfinance/blob/master/README.md Utilize the screener functionality to retrieve lists of tickers based on specified filters. This includes overview, valuation, financial, ownership, performance, and technical data. The Overview class is used as an example, demonstrating how to set filters and retrieve a dataframe. ```python from finvizfinance.screener.overview import Overview foverview = Overview() filters_dict = {'Index':'S&P 500','Sector':'Basic Materials'} foverview.set_filter(filters_dict=filters_dict) df = foverview.screener_view() df.head() ``` -------------------------------- ### Get Insider Trading Information Source: https://github.com/lit26/finvizfinance/blob/master/README.md Retrieve insider trading data from FinViz, with options to filter by 'latest', 'top week', or 'top owner trade'. The Insider class is initialized with an option, and then the get_insider method is called. ```python from finvizfinance.insider import Insider finsider = Insider(option='top owner trade') # option: latest, top week, top owner trade # default: latest insider_trader = finsider.get_insider() ``` -------------------------------- ### GET /screener/signal Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves a list of companies that match a specific technical analysis signal, such as 'Triangle Ascending'. ```APIDOC ## GET /screener/signal ### Description Fetch a list of stocks filtered by a specific technical signal. ### Method GET ### Endpoint /screener/signal ### Parameters #### Query Parameters - **signal** (string) - Required - The technical signal name (e.g., 'Triangle Ascending') ### Request Example { "signal": "Triangle Ascending" } ### Response #### Success Response (200) - **Ticker** (string) - Stock symbol - **Company** (string) - Company name - **Sector** (string) - Industry sector - **Price** (float) - Current market price #### Response Example { "Ticker": "SMCP", "Company": "AlphaMark Actively Managed Small Cap ETF", "Price": 30.96 } ``` -------------------------------- ### Get Performance Data by Industry Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves stock performance data, grouped by industry, using the Performance module. ```APIDOC ## Get Performance Data by Industry ### Description Retrieves stock performance data, grouped by industry, using the Performance module. ### Method ```python from finvizfinance.group.performance import Performance fgperformance = Performance() df = fgperformance.screener_view(group='Industry') df.tail() ``` ### Response Example ```json { "Name": "Utilities - Regulated Electric", "Perf Week": "2.23%", "Perf Month": "0.0232", "Perf Quart": "0.0109", "Perf Half": "0.0318", "Perf Year": "0.0819", "Perf YTD": "0.0632", "Recom": "2.38", "Avg Volume": "65030000.0", "Rel Volume": "0.74", "Change": "0.0050", "Volume": "48220000.0" } ``` ``` -------------------------------- ### Get Forex Performance Data Source: https://context7.com/lit26/finvizfinance/llms.txt Retrieves forex performance data, including price and performance metrics across different time intervals (5-minute, hourly, daily, weekly, monthly). The output DataFrame includes columns like Ticker, Price, and Perf Day. ```python from finvizfinance.forex import Forex fforex = Forex() df = fforex.performance() ``` -------------------------------- ### Get Insider Trading Data - Python Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves insider trading data for a specific option using the FinvizFinance library. It takes an 'option' parameter and returns a pandas DataFrame with details such as ticker, owner, transaction type, cost, and SEC filing links. ```python from finvizfinance.insider import Insider finsider = Insider(option='1771340') finsider.get_insider().head() ``` -------------------------------- ### Fetch Industry Valuation Data Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb This code retrieves valuation data for various industries using the FinvizFinance library's group valuation module. It initializes the Valuation class and calls the 'screener_view' method with the 'Industry' group to get a DataFrame containing industry names, market cap, P/E ratios, and other valuation metrics. ```python from finvizfinance.group.valuation import Valuation fgvaluation = Valuation() df = fgvaluation.screener_view(group='Industry') df.tail() ``` -------------------------------- ### GET /statements Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves financial statements (Balance Sheet, Income Statement, Cash Flow) for a specific ticker symbol. ```APIDOC ## GET /statements ### Description Fetches financial statement data for a given stock ticker, allowing filtering by statement type and timeframe. ### Method GET ### Endpoint /statements ### Parameters #### Query Parameters - **ticker** (string) - Required - The stock ticker symbol (e.g., AAPL). - **statement** (string) - Required - Type of statement: 'B' (Balance Sheet), 'I' (Income), 'C' (Cash Flow). - **timeframe** (string) - Required - Frequency: 'Q' (Quarterly) or 'A' (Annual). ### Request Example GET /statements?ticker=AAPL&statement=B&timeframe=Q ### Response #### Success Response (200) - **data** (dataframe) - Returns a table containing the requested financial statement data. #### Response Example { "Period End Date": ["9/25/2021", "6/26/2021"], "Cash and Equivalents": [17635.00, 19197.00] } ``` -------------------------------- ### Get Ticker Signal - Python Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Retrieves trading signals for a given stock ticker. The function returns a list of signals such as 'Most Active' or 'Major News'. ```python stock.ticker_signal() ``` -------------------------------- ### Filter Stocks by Technical Signal Source: https://context7.com/lit26/finvizfinance/llms.txt Filters stocks based on technical indicators like 'Triangle Ascending' and retrieves a screener view ordered by market capitalization. It also demonstrates how to get single ticker information and compare a ticker with similar stocks. ```python from finvizfinance.screener import Overview foverview = Overview() foverview.set_filter(signal='Triangle Ascending') df = foverview.screener_view(order='Market Cap', ascend=False, limit=50) foverview.set_filter(signal='', filters_dict={}, ticker='TSLA') df = foverview.screener_view() df = foverview.compare('TSLA', compare_list=['Sector', 'Industry', 'Country']) ``` -------------------------------- ### Display Stock Chart Image Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Demonstrates how to display a stock chart image locally using IPython.display.Image. This requires the chart image file to be saved first. ```python from IPython.display import Image # Assuming 'tsla.jpg' is the saved chart image file Image(filename='tsla.jpg') ``` -------------------------------- ### Display Blogs Head - Python Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Displays the first 5 blog posts from the retrieved blog data. This allows for a quick review of recent blog content and their sources. ```python all_news['blogs'].head() ``` -------------------------------- ### Proxy and Timeout Configuration Source: https://context7.com/lit26/finvizfinance/llms.txt Configure a proxy server and custom timeout for all FinVizFinance requests. The proxy is set using a dictionary of 'http' and 'https' URLs, and the timeout can be adjusted from the default 10 seconds. ```python from finvizfinance.util import set_proxy, set_timeout # Set proxy for requests proxies = {'http': 'http://127.0.0.1:8080', 'https': 'http://127.0.0.1:8080'} set_proxy(proxies) # Set custom timeout (default is 10 seconds) set_timeout(30) # Now all finvizfinance requests will use the proxy from finvizfinance.quote import finvizfinance stock = finvizfinance('AAPL') # Uses configured proxy ``` -------------------------------- ### Stock Screener - Performance Metrics Source: https://context7.com/lit26/finvizfinance/llms.txt Screens stocks based on performance metrics over various time periods like weekly, monthly, quarterly, and yearly. It allows filtering by index and ordering results by performance. The output includes columns like Perf Week, Perf Month, and Perf Year. ```python from finvizfinance.screener.performance import Performance fperformance = Performance() filters_dict = {'Index': 'S&P 500'} fperformance.set_filter(filters_dict=filters_dict) df = fperformance.screener_view(order='Perf Week', ascend=False) ``` -------------------------------- ### Forex Charting with FinvizFinance Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb This snippet demonstrates how to generate a chart for a specific forex currency pair using the FinvizFinance library. It requires the 'forex' module and takes a currency pair symbol as input. ```python fforex.chart('audusd') ``` -------------------------------- ### Fetch Stock Quotes and Fundamentals Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/index.md Initialize a stock object to retrieve ticker charts, fundamental data, descriptions, peer information, ETF holders, ratings, news, and insider trading data. ```python from finvizfinance.quote import finvizfinance stock = finvizfinance('tsla') stock.TickerCharts(out_dir='asset') 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() ``` -------------------------------- ### Fetch Industry Overview Data Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb This snippet shows how to obtain an overview of different industries using the FinvizFinance library's group overview module. It initializes the Overview class and uses the 'screener_view' method with the 'Industry' group to fetch a DataFrame with industry-specific stock data, market cap, and financial ratios. ```python from finvizfinance.group.overview import Overview fgoverview = Overview() df = fgoverview.screener_view(group='Industry') df.tail() ``` -------------------------------- ### Configure Optional Proxy Settings Source: https://github.com/lit26/finvizfinance/blob/master/README.md Set up optional proxy configurations for making requests to the FinViz website. The set_proxy function from the finvizfinance.util module can be used to configure HTTP and HTTPS proxies. ```python from finvizfinance.util import set_proxy proxies={'http': 'http://127.0.0.1:8080'} set_proxy(proxies) ``` -------------------------------- ### Proxy Configuration Source: https://github.com/lit26/finvizfinance/blob/master/README.md Configure optional proxy settings for making requests to the FinViz website. ```APIDOC ## Proxy Configuration ### Description This utility allows you to set up proxy servers for your HTTP requests, which can be useful for managing network access or anonymity when scraping data from FinViz. ### Method N/A (This is a library usage guide, not a REST API) ### Endpoint N/A ### Parameters - **proxies** (dict) - Required - A dictionary defining the proxy configuration. For example: `{'http': 'http://127.0.0.1:8080'}`. ### Request Example ```python from finvizfinance.util import set_proxy proxies = {'http': 'http://127.0.0.1:8080'} set_proxy(proxies) ``` ### Response #### Success Response (200) Proxy settings are applied internally. No explicit return value is documented for success. #### Response Example N/A ``` -------------------------------- ### Retrieve Individual Company Data using FinvizFinance Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb This code snippet shows how to fetch detailed information for a specific company by its ticker symbol. It initializes the `Screener` class, sets the ticker using `set_filter`, and then retrieves the data with `screener_view`. The result is a DataFrame with the company's financial data. ```python from finvizfinance.screener import Screener ticker='TSLA' foverview = Screener(ticker=ticker) df = foverview.screener_view() df.head() ``` -------------------------------- ### Download or Retrieve Stock Charts Source: https://context7.com/lit26/finvizfinance/llms.txt Download stock charts or retrieve their URLs with configurable timeframes and chart types. ```python from finvizfinance.quote import finvizfinance stock = finvizfinance('TSLA') chart_url = stock.ticker_charts() chart_url = stock.ticker_charts(timeframe='weekly', charttype='candle', out_dir='charts') chart_url = stock.ticker_charts(timeframe='monthly', charttype='line', urlonly=True) ``` -------------------------------- ### Stock Screener Overview - Python Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Uses the FinvizFinance library to screen stocks based on specified filters. It allows setting filters for exchange and sector, then retrieves a view of the screener results ordered by company name, returning a pandas DataFrame. ```python 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(order='Company') df.head() ``` -------------------------------- ### Retrieve Financial News and Blog Posts Source: https://context7.com/lit26/finvizfinance/llms.txt Fetches the latest financial news and blog posts from FinViz. The results are returned in a dictionary containing 'news' and 'blogs' DataFrames, each with columns for Date, Title, Source, and Link. ```python from finvizfinance.news import News fnews = News() all_news = fnews.get_news() news_df = all_news['news'] blogs_df = all_news['blogs'] print(news_df.head()) ``` -------------------------------- ### Stock Screener - Financial Metrics Source: https://context7.com/lit26/finvizfinance/llms.txt Screens stocks using financial metrics including ROA, ROE, debt ratios, and margins. Users can filter by sector and market cap, and retrieve detailed financial columns. It also supports comparing a ticker with similar companies. ```python from finvizfinance.screener.financial import Financial ffinancial = Financial() filters_dict = {'Sector': 'Healthcare', 'Market Cap': 'Large ($10bln to $200bln)'} ffinancial.set_filter(filters_dict=filters_dict) df = ffinancial.screener_view() df = ffinancial.compare('TSLA', compare_list=['Sector', 'Industry', 'Country'], verbose=0) ``` -------------------------------- ### Use Market Screener Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/index.md Configure and execute a market screener filter to retrieve a DataFrame of stocks matching specific criteria like exchange and sector. ```python 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() ``` -------------------------------- ### Stock Screener - Valuation Metrics Source: https://context7.com/lit26/finvizfinance/llms.txt Screens stocks based on valuation metrics such as P/E, P/B, and P/S ratios. It allows filtering by exchange and sector, and ordering results by P/E ratio. The output includes columns like Ticker, Market Cap, P/E, and Fwd P/E. ```python from finvizfinance.screener.valuation import Valuation fvaluation = Valuation() filters_dict = {'Exchange': 'NYSE', 'Sector': 'Technology'} fvaluation.set_filter(filters_dict=filters_dict) df = fvaluation.screener_view(order='P/E', limit=100) ``` -------------------------------- ### Group Analysis (Overview, Valuation, Performance, Spectrum) Source: https://context7.com/lit26/finvizfinance/llms.txt Analyze stocks grouped by categories like 'Industry', 'Sector', or 'Country'. Retrieve overview, valuation, performance data, or download spectrum visualizations. Supports ordering by 'Name' or 'Market Cap'. ```python from finvizfinance.group.overview import Overview from finvizfinance.group.valuation import Valuation from finvizfinance.group.performance import Performance from finvizfinance.group.spectrum import Spectrum # Group overview by industry fgoverview = Overview() df = fgoverview.screener_view(group='Industry', order='Name') # Columns: Name, Stocks, Market Cap, Dividend, P/E, Fwd P/E, PEG, Float Short, Change, Volume # Group valuation by sector fgvaluation = Valuation() df = fgvaluation.screener_view(group='Sector', order='Market Cap') # Columns: Name, Market Cap, P/E, Fwd P/E, PEG, P/S, P/B, P/C, P/FCF, ... # Group performance by industry fgperformance = Performance() df = fgperformance.screener_view(group='Industry') # Columns: Name, Perf Week, Perf Month, Perf Quart, Perf Half, Perf Year, ... # Download spectrum visualization fgspectrum = Spectrum() fgspectrum.screener_view(group='Sector', out_dir='charts') # Group options: 'Sector', 'Industry', 'Country', 'Capitalization', etc. ``` -------------------------------- ### Retrieve Individual Stock Data Source: https://context7.com/lit26/finvizfinance/llms.txt Use the finvizfinance class to fetch fundamental data, news, insider trading, and analyst ratings for a specific ticker. ```python from finvizfinance.quote import finvizfinance stock = finvizfinance('TSLA') 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() signals = stock.ticker_signal() full_info = stock.ticker_full_info() ``` -------------------------------- ### Fetch Industry Performance Data with Finvizfinance Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb This snippet shows how to use the Performance module from finvizfinance to retrieve stock performance data grouped by industry. It initializes the Performance object and calls the screener_view method with the 'Industry' group. The output is a pandas DataFrame containing performance metrics. ```python from finvizfinance.group.performance import Performance fgperformance = Performance() df = fgperformance.screener_view(group='Industry') df.tail() ``` -------------------------------- ### Display News Head - Python Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Displays the first 5 news articles from the retrieved news data. This provides a quick look at the latest headlines and their sources. ```python all_news['news'].head() ``` -------------------------------- ### Retrieve Financial News Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/index.md Fetch the latest financial news and blog posts using the News module. ```python from finvizfinance.news import News fnews = News() all_news = fnews.get_news() ``` -------------------------------- ### Filter Stocks with Screener Source: https://context7.com/lit26/finvizfinance/llms.txt Use the Overview screener to filter stocks based on criteria like index, sector, and industry. ```python from finvizfinance.screener.overview import Overview foverview = Overview() filters_dict = {'Index': 'S&P 500', 'Sector': 'Basic Materials'} foverview.set_filter(filters_dict=filters_dict) df = foverview.screener_view() ``` -------------------------------- ### Filter Stocks by Signal using FinvizFinance Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb This snippet demonstrates how to filter stocks based on a specific technical signal like 'Triangle Ascending'. It uses the `set_filter` method to apply the signal and then `screener_view` to retrieve the filtered data. The output is a Pandas DataFrame containing stock information. ```python from finvizfinance.screener import Screener signal = 'Triangle Ascending' foverview = Screener(signal=signal) df = foverview.screener_view() df.head() ``` -------------------------------- ### Earnings Class Initialization Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/earnings.md Initializes the Earnings class to retrieve earnings data for a specified period. ```APIDOC ## Initialize Earnings Class ### Description Initializes the Earnings class to fetch earnings data for a specified period. ### Method __init__ ### Parameters #### Parameters - **period** (str) - Optional - Choose an option of period ('This Week', 'Next Week', 'Previous Week', 'This Month'). Defaults to 'This Week'. ### Request Example ```python from finvizfinance.earnings import Earnings earnings = Earnings(period='Next Week') ``` ### Response #### Success Response (Initialization) - **earnings_object** (Earnings) - An initialized Earnings object. #### Response Example ```python # No direct response, object is created in memory ``` ``` -------------------------------- ### Stock Screener - Ownership Data Source: https://context7.com/lit26/finvizfinance/llms.txt Screens stocks based on institutional ownership and short interest data. It allows filtering by sector and short float percentage. The output includes columns like Insider Own, Insider Trans, and Inst Own. ```python from finvizfinance.screener.ownership import Ownership fownership = Ownership() filters_dict = {'Sector': 'Technology', 'Short Float': 'Over 30%'} fownership.set_filter(filters_dict=filters_dict) df = fownership.screener_view() ``` -------------------------------- ### Futures Performance Data Source: https://context7.com/lit26/finvizfinance/llms.txt Retrieve futures market performance data for different timeframes including Daily ('D'), Weekly ('W'), Monthly ('M'), Quarterly ('Q'), Half Year ('HY'), and Yearly ('Y'). ```python from finvizfinance.future import Future ffuture = Future() # Get daily futures performance df = ffuture.performance(timeframe='D') # Get weekly futures performance df = ffuture.performance(timeframe='W') # Timeframe options: 'D' (Daily), 'W' (Weekly), 'M' (Monthly), # 'Q' (Quarterly), 'HY' (Half Year), 'Y' (Yearly) ``` -------------------------------- ### Compare Stocks Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/screener.md Retrieves a screener table of similar stocks based on specified properties like Sector, Industry, or Country. ```APIDOC ## compare(ticker, compare_list, order='ticker', verbose=1) ### Description Get screener table of similar property (Sector, Industry, Country). ### Parameters #### Path Parameters - **ticker** (str) - Required - The ticker symbol of the stock to compare. - **compare_list** (list) - Required - A list of properties to compare (e.g., ['Sector', 'Industry', 'Country']). #### Query Parameters - **order** (str) - Optional - The property to sort the resulting table by. Defaults to 'ticker'. - **verbose** (int) - Optional - Controls the visualization of progress. 1 to visualize progress. Defaults to 1. ### Response #### Success Response (200) - **screener_information** (pandas.DataFrame) - A DataFrame containing the screener information table. ``` -------------------------------- ### Partition Earnings Data by Day Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/earnings.md Partitions the earnings data into separate dataframes based on dates. ```APIDOC ## Partition Earnings by Day ### Description Partitions the main earnings dataframe into separate dataframes based on specific dates. ### Method partition_days ### Parameters #### Parameters - **mode** (str) - Optional - Specifies the type of data to partition. Choose from 'financial', 'overview', 'valuation', 'ownership', 'performance', 'technical'. Defaults to 'financial'. ### Request Example ```python dataframes = earnings.partition_days(mode='overview') ``` ### Response #### Success Response (200) - **partitioned_dataframes** (dict) - A dictionary where keys are dates and values are dataframes containing earnings information for that date. #### Response Example ```json { "2023-10-27": { "ticker": "AAPL", "eps_estimate": 1.25, "eps_actual": 1.30, "surprise": 4.0 }, "2023-10-28": { "ticker": "MSFT", "eps_estimate": 2.10, "eps_actual": 2.15, "surprise": 2.4 } } ``` ``` -------------------------------- ### Retrieve Financial Statements Source: https://context7.com/lit26/finvizfinance/llms.txt Fetch income statements, balance sheets, and cash flow statements for a ticker in annual or quarterly formats. ```python from finvizfinance.quote import Statements statement = Statements() income_df = statement.get_statements('AAPL', statement='I', timeframe='A') balance_df = statement.get_statements('AAPL', statement='B', timeframe='Q') cashflow_df = statement.get_statements('AAPL', statement='C', timeframe='A') ``` -------------------------------- ### Display DataFrame Head - Python Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Displays the first 5 rows of a pandas DataFrame. This is commonly used to quickly inspect the structure and content of a DataFrame after data retrieval. ```python inside_trader_df.head() ``` -------------------------------- ### POST /screener/filter Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/screener.md Updates the filter settings for subsequent screener queries. ```APIDOC ## POST /screener/filter ### Description Update the screener settings including signals, filters, and ticker context. ### Method POST ### Endpoint /screener/filter ### Parameters #### Request Body - **signal** (str) - Optional - Ticker signal - **filters_dict** (dict) - Optional - Dictionary of filters - **ticker** (str) - Optional - Ticker string ### Response #### Success Response (200) - **status** (string) - Confirmation of settings update ``` -------------------------------- ### Compare Stocks by Financials - Python Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Compares a given ticker symbol against others based on specified financial metrics. This function takes a ticker and a list of comparison parameters (e.g., 'Sector', 'Industry') and returns a DataFrame with the comparison results. The 'verbose' parameter controls the output level. ```python ticker = 'tsla' compare_list = ['Sector','Industry','Country'] from finvizfinance.screener.financial import Financial ffinancial = Financial() df = ffinancial.compare(ticker,compare_list,verbose=0) df ``` -------------------------------- ### Earnings Calendar and Data Export Source: https://context7.com/lit26/finvizfinance/llms.txt Fetch earnings dates and associated financial data, partitioned by day. Supports exporting data to CSV files (one per day) or a single Excel file with sheets per day. Available periods include 'This Week', 'Next Week', 'Previous Week', 'This Month'. ```python from finvizfinance.earnings import Earnings # Get earnings for this week fearnings = Earnings(period='This Week') # Partition earnings by day with financial data df_days = fearnings.partition_days(mode='financial') # Returns dict with date keys, each containing DataFrame # Access specific day's earnings dec_6_earnings = df_days['Dec 06/a'] # 'a' = after market, 'b' = before market # Columns: Ticker, Market Cap, Dividend, ROA, ROE, ROI, Curr R, Quick R, ... # Export to CSV files (one per day) fearnings.output_csv(output_dir='earnings_data') # Export to single Excel file with sheets per day fearnings.output_excel(output_file='earnings_calendar.xlsx') # Period options: 'This Week', 'Next Week', 'Previous Week', 'This Month' # Mode options: 'financial', 'overview', 'valuation', 'ownership', 'performance', 'technical' ``` -------------------------------- ### Display Head of News DataFrame Source: https://github.com/lit26/finvizfinance/blob/master/example/example.ipynb Displays the first few rows of the DataFrame containing news articles related to the stock. This includes the date, title, and source of recent news. ```python news_df.head() ``` -------------------------------- ### Forex and Crypto Data API Source: https://context7.com/lit26/finvizfinance/llms.txt Endpoints for retrieving performance data and downloading technical charts for Forex and Cryptocurrency assets. ```APIDOC ## GET /forex/performance ### Description Retrieves forex performance data, optionally in PIPS. ### Method GET ### Parameters #### Query Parameters - **change** (string) - Optional - Unit of change, e.g., 'PIPS' or 'percent'. ## GET /crypto/chart ### Description Downloads a chart image or retrieves the URL for a specific cryptocurrency. ### Method GET ### Parameters #### Query Parameters - **ticker** (string) - Required - The crypto symbol (e.g., 'BTCUSD'). - **timeframe** (string) - Required - Options: '5M', 'H', 'D', 'W', 'M'. - **urlonly** (boolean) - Optional - If true, returns only the URL. ``` -------------------------------- ### Set Filter Source: https://github.com/lit26/finvizfinance/blob/master/docs/source/screener.md Updates the Finvizfinance settings with specified filters, signals, or tickers. ```APIDOC ## set_filter(signal='', filters_dict={}, ticker='') ### Description Update the settings. ### Parameters #### Query Parameters - **signal** (str) - Optional - The ticker signal to set. - **filters_dict** (dict) - Optional - A dictionary of filters to apply. - **ticker** (str) - Optional - The ticker string to associate with the settings. ```