A package to retrieve historical fundamental financial data such as income statement, balance sheet, and cash flow statement directly from the SEC with no request caps and fast request rate limits.
Project description
finqual
This is a work in progress package that enables users to conduct fundamental financial research, utilising the SEC's data and REST API.
Features
finqual has the following features:
- Ability to call the income statement, balance sheet or cash flow statement for any company on SEC's Electronic Data Gathering, Analysis, and Retrieval (EDGAR) system.
- Retrieve comparables companies for a chosen ticker on varying industry classifications (e.g. more general industry classifications or more detailed classifications)
- Breakdown of chosen financial ratios for a chosen ticker
- Custom balance sheet for banks and other financial services firms
This has two key features that enable better programmatic access compared to other providers:
- Ability to call up to 10 requests per second, with built-in rate limiter
- No restriction on the number of calls within a certain timeframe
Quick-start guide
This provides section provides a quick overview on the functions available within the finqual package.
from finqual import finqual as fq
fq.Ticker("TSLA").income(2020,2022) #Get annual income statements from 2020 to 2022
fq.Ticker("TSLA").income(2020,2022, quarter = True) #Get quarterly income statements from 2020 to 2022
fq.Ticker("TSLA").balance(2020,2022) #Get annual balance sheets from 2020 to 2022
fq.Ticker("TSLA").balance(2020,2022, quarter = True) #Get quarterly balance sheets from 2020 to 2022
fq.Ticker("TSLA").cashflow(2020,2022) #Get annual cash flow statements from 2020 to 2022
fq.Ticker("TSLA").cashflow(2020,2022) #Get quarterly cash flow statements from 2020 to 2022
fq.Ticker("TSLA").ratios(2018,2020) #Get selected financial ratios and the average from 2020 to 2022
fq.Ticker("TSLA").comparables(5) #Get five comparable companies for TSLA (by market cap) that are in the same 4 digit SIC industry classification
fq.Ticker("TSLA").comparables(5,3) #Get five comparable companies for TSLA (by market cap) that are in the same 3 digit SIC industry classification
In-depth guide
First, ensure that the required packages are installed (see the "Dependencies" section). Then, import the package using:
from finqual import finqual as fq
From there, we use this initalised "Ticker" instance to call the desired function. These functions are:
"""
Financial statement functions
"""
fq.Ticker("TSLA").income(start, end, quarter)
fq.Ticker("TSLA").balance(start, end, quarter)
fq.Ticker("TSLA").cashflow(start, end, quarter)
"""
Other fundamental financial research functions
"""
fq.Ticker("TSLA").ratios(start, end)
fq.Ticker("TSLA").comparables(n, level = None)
The financial statement functions (income
, balance
and cashflow
) takes a mandatory timeframe input start
and end
, and then an optional input to return the quarterly results within that timeframe by setting quarter = True
, otherwise defaulting to returning annual results.
The ratios
function calculates selected financial ratios for the specified timeframe and returns the mean average over that timeframe. The selected financial ratios are a selection of liquidity, profitability and valuation ratios, which are commonly used to compare against other companies,
The comparables
function returns a list of n
comparable companies based on the SIC code of the initialized ticker (i.e. companies in the same industry as the chosen company). The comparable companies are selected based on market capitalisation, and users can adjust the optional input level
to determine the number of SIC digits to consider, whereby level takes an integer from 1 to 4, with 4 being the default and the most granular industry classification possible within the package.
Dependencies
Only five packages are required, with the following versions confirmed to be working:
Package | Version |
---|---|
pandas | >= 2.1.2 |
numpy | >= 1.24.3 |
requests | >= 2.28.1 |
ratelimit | >= 2.2.1 |
datetime | >= 5.1 |
Limitations
Currently, there are several known limitations that I am aware of from my own testing. These are still to be looked at:
- Missing data values for companies, this is mostly due to companies using custom tags that are not accessible via the SEC database or use the IFRS taxonomy instead of the US GAAP taxonomy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file finqual-1.5.2.tar.gz
.
File metadata
- Download URL: finqual-1.5.2.tar.gz
- Upload date:
- Size: 441.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5a49547275dd56205cf24ca3c09585976f6790c01268d849fb9ddb04c4d969d |
|
MD5 | 9eb11361e4b058c41c7f7e13cca8ac16 |
|
BLAKE2b-256 | 9ddb319836ceac6b6a46fdb3558d3fb7e52b40cccc127d7ec3b084eba1309b46 |
File details
Details for the file finqual-1.5.2-py3-none-any.whl
.
File metadata
- Download URL: finqual-1.5.2-py3-none-any.whl
- Upload date:
- Size: 443.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7017857b3a12ee9da8e1fc6a8ea8b94d2f49cc53c59cdd08e45bd7d1b323a246 |
|
MD5 | 2408da1fda71fa290ad7cb7a74a2cd56 |
|
BLAKE2b-256 | b2ce78f06f47251cebc78bcb6630ee242032d29c1bfdd2c7b22ea826e3504d20 |