Giter VIP home page Giter VIP logo

fundamental-analysis's Introduction

Fundamental Analysis

Fundamental Analysis is a program that allows me to screen stocks using fundamental indicators and estimate the intrinsic value of qualified stocks using the Discounted Cash Flow method of valuation.

The logic accomplishes 5 primary tasks:

  1. Downloads all stock tickers available via the FinancialModelingPrep API and generates profiles on each company
  2. Retrieves and cleans financial statement data on each company
  3. Screens companies on any chosen indicators of value (ex: 8-Year Median ROE)
  4. Plots the stability of core indicators over an N-year period
    • Includes: EPS, Dividend Per Share, Book Value per Share, ROE, Current Ratio, Debt to Equity Ratio
  5. Estimates the intrinsic value, margin of safety value for chosen companies

alt text

Functions

I've listed the available functions separated by module below for anyone that wishes to build upon this logic.

Notes:

  1. The FinancialModelingPrep API appears to be updated frequently. As a result, changes in data availability / functionality may occur.
  2. It is not necessary to use the functions prefixed with the word 'calculate' in the company_fundamentals module in order to calculate the intrinsic value of a company. You can get a given company's discounted cash flow directly from the FinancialModeling Prep API here. I simply opted to build the DCF logic myself in order to better understand how it works. It was not a great programming choice as errors will result if column names change.
  • company_profiles
    • get_company_data - Retrieves 'symbol', 'name', 'price', and 'exchange' information for all available stock tickers
    • select_stock_exchanges - Filters out stock tickers that are not listed on one of the major exchanges: 'Nasdaq Global Select', 'NasdaqGS', 'Nasdaq', 'New York Stock Exchange', 'NYSE', 'NYSE American'
    • select_minimum_price - Filters out stock tickers that have a price less than the one specified by the user
    • create_company_profile - Retrieves additional company information for each stock ticker provided, writes data to csv file, stores file in the specified directory
  • company_financials
    • select_sector - Filters out stock tickers that do not belong to the specified sectors
    • select_industries - Filters out stock tickers that do not belong to the specified industries
    • get_financial_data - Retrieves any of the following financial datasets for each of the stock tickers provided: Financial Statements, Financial Ratios, Financial Growth, Key Company Metrics, Enterprise Value
    • clean_financial_data - Scans DataFrame containing financial data on N stock stickers and removes rows with corrupted date values. Adds a new 'year' column as well for future use
    • select_analysis_years - Remove stock tickers without financial reports in a specified timeframe (ex: L10Y) and subset DataFrame to only include the years specified (ex: 2015 - 2020)
  • company_fundamentals
    • combine_data - Read and join all files in a specified directory (ex: 'data/') with a specified year pattern (ex: '2Y')
    • calculate_stats - Calculate the mean, median, or percent change of provided columns over an N-year period
    • screen_stocks - Filter out stock tickers with column values that do not fall within specified ranges
    • plot_performance - Plot stock performance over time with respect to the following column values: 'Earnings per Share', 'Dividend per Share', 'Book Value per Share', 'Return on Equity', 'Current Ratio', 'Debt to Equity Ratio'. Note that 'Dividend per Share' is commented out as the column name seems to have disappeared in a recent API update
    • prepare_valuation_inputs - Subset DataFrame to include only the data required for Discounted Cash Flow model calculations
    • calculate_discount_rate - Calculated the Weighted Average Cost of Capital (WACC) for each stock ticker provided
    • calculate_discounted_free_cash_flow - Calculate the present value of discounted future cash flows for each stock ticker provided
    • calculate_terminal_value - Calculate the terminal value for each stock ticker for each stock ticker provided
    • calculate_intrinsic_value - Calculate the intrinsic value of each stock ticker provided
    • calculate_margin_of_safety - Calculate the margin of safety value of each stock ticker provided

References

fundamental-analysis's People

Contributors

hjones20 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.