Skip to content

A script to create a fundamental analysis report for a company using financial modeling prep

License

Notifications You must be signed in to change notification settings

portfedh/fundamental_analysis_report

Repository files navigation

Fundamental Analysis Report

Image of a Report

You can find a more in depth explanation of the script in this blog post.

Note: The script wil not work if you run it in a file path that has spaces in its name.

What it does

The script creates a PDF report showing 5 years of financial history of the company being analysed.

Its aim is to serve as a second level stock screener.

The report will output a PDF with the following information:

  • A general description of the company.
  • Financial statements (5 years):
    • Nominal ($)
    • Common size (%)
  • Graphs (5 years):
    • The income statement ($)(%)
    • The balance sheet ($)(%)
    • The cash flow statement ($)(%)
    • Profit distribution or reinvestment ($)

The file Fundamental_analysis.ipynb was written using Jupiter Notebook. It can be executed by changing the company variable and running all cells.

How to Install

To use this script, you must have previously installed:

All modules are available from anaconda and pip. I had some issues using the FPDF2 module from anaconda, and recommend installing from pip.

I also had some issues with Kaleido. For some reason it wont work in a virtual environment. I had to install in my global environment and update this package using:

pip install -U kaleido

You will also need a token from Financial Modeling Prep to be able to use the script.

Financial Modeling prep is a stock data provider.

They cover NYSE, NASDAQ, AMEX, EURONEX, TSX, INDEXES, ETFs, MUTUAL FUNDS, FOREX and CRYPTO.

Financial Modeling Prep has a free version, which allows for 250 requests per day and covers all the US markets. Paid subscriptions give coverage to the rest of the stocks and an unlimited number of requests.

How to Use

Setup

  1. Download the script.

  2. Download the required dependencies.

  3. In the same folder as the script add a folder named "images".

  4. Inside the folder images add two folders named "input" and "output"

  5. Inside the "input" folder, add your logo.

    • The current logo is named BS-Logo.png.
    • Current logo is: width 306 pixels, height 188 pixels.
    • When you substitute, make sure to update the filename inside the script or name it BS-Logo.png .

Running

Jupyter Notebook: Fundamental_analysis.ipynb

  1. Write the company ticker in the variable name.
  2. Restart the kernel and run all cells.

You can see an example of the output file in the file named Example_Report.pdf.

Use cases

The script is useful for anyone interested in exploring the financial position of a company.

Contributing

Some things that could make the script better could be:

  • Exporting the data to excel as a second output file.
  • Making the report to analyze quarters instead of years.
  • Making the report analyze rolling 5 years, instead of hardcoding the numbers.
  • Making the code adapt to companies with less than five years of data.

About

A script to create a fundamental analysis report for a company using financial modeling prep

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published