Note

Refer to FundamentalAnalysis Jupyter Notebook for more details.

FundamentalAnalysis

Installation

Note

Before working with this API, you will need to obtain a key from FinancialModellingPrep’s API

Install with pip:

pip install FundamentalAnalysis

Usage

Note

FundamentalAnalysis automatically uses Pandas DataFrames.

Import all necessary libraries:

import FundamentalAnalysis as fa
import financedatabase as fd
import pandas as pd

ticker = "TSLA"
api_key = "your api key"

List all Commands

Gets all of the options from cryptocurrencies, currencies, equities, etfs or funds that are available to be queried.

# Options: 'cryptocurrencies', 'currencies', 'equities', 'etfs' or 'funds'
options = fd.show_options('cryptocurrencies', equities_selection=None, country=None, sector=None, industry=None)
options = pd.DataFrame(options)
options

Lists all of the companies that the API offers to be queried.

# Show the available companies
companies = fa.available_companies(api_key)
companies.sort_values('symbol')

Lists all of the exchanges available for access.

companies.exchange.unique()

Historical Price and Volume for 1 Stock

Gets the OHLCV for one stock, given the period and interval.

# General stock data
stock_data = fa.stock_data(ticker, period="ytd", interval="1d")

# Detailed stock data
stock_data_detailed = fa.stock_data_detailed(ticker, api_key, begin="2000-01-01", end="2020-01-01")
stock_data_detailed

Financial Ratios

Warning

This feature requires a premium subscription.

# Large set of in-depth ratios
financial_ratios_annually = fa.financial_ratios(ticker, api_key, period="annual")
financial_ratios_quarterly = fa.financial_ratios(ticker, api_key, period="quarter")

Stock Fundamentals

profile = fa.profile(ticker, api_key)
profile

Financials

Warning

This feature requires a premium subscription.

ticker ="DIS"
# Balance Sheet statements
balance_sheet_annually = fa.balance_sheet_statement(ticker, api_key, period="annual")
balance_sheet_quarterly = fa.balance_sheet_statement(ticker, api_key, period="quarter")
# Income Statements
income_statement_annually = fa.income_statement(ticker, api_key, period="annual")
income_statement_quarterly = fa.income_statement(ticker, api_key, period="quarter")
# Cash Flow Statements
cash_flow_statement_annually = fa.cash_flow_statement(ticker, api_key, period="annual")
cash_flow_statement_quarterly = fa.cash_flow_statement(ticker, api_key, period="quarter")

Key Metrics

Warning

This feature requires a premium subscription.

# Key Metrics
key_metrics_annually = fa.key_metrics(ticker, api_key, period="annual")
key_metrics_quarterly = fa.key_metrics(ticker, api_key, period="quarter")

Sentiment

Gets various ratings and scores for the given ticker.

ratings = fa.rating(ticker, api_key)