Calculates fundamental analysis indicators of Brazilian companies
Project description
About
ibr is a Python library that calculates fundamental analysis indicators
of Brazilian companies registered at CVM.
The reason for creating this library is that CVM things must belong to the cvm library, whereas fundamental analysis indicators, insofar they are something greater than CVM, should be separated.
Moreover, valuation indicators depend on market data, which is beyond CVM's responsibility, since CVM is not a stock exchange.
Usage
Financial Indicators
The code below opens a DFP/ITR document and shows financial indicators of companies in that document:
import ibr
for result in ibr.reader('/path/to/dfp_or_itr.zip', (ibr.Indebtedness, ibr.Profitability, ibr.Efficiency)):
indebtedness, profitability, efficiency = result.indicators
print('----------------------------')
print('Company:', result.dfpitr.company_name)
print('\nIndebtedness:')
print(indebtedness)
print('\nEfficiency:')
print(efficiency)
print('\nProfitability:')
print(profitability)
Valuation Indicators
As for valuation indicators, they need market data. Since market data is not provided in a DFP/ITR file, because this is beyond CVM's scope, such data must be obtained from the internet or some other source.
For that, the library ibr provides a class YfinanceValuation, which
is based on the libraries b3 and yfinance:
import ibr
for result in ibr.reader('/path/to/dfp_or_itr.zip', [ibr.YfinanceValuation]):
print('------------------')
print('Company:', result.dfpitr.company_name)
valuations = result.indicators[0]
for valuation in valuations:
print('\nValuation:')
print(valuation)
Note that valuation indicators return a list, because it is possible that
a company has more than one security. An example is the company Eletrobrás,
which has three securities on B3: ELET3, ELET5 e ELET6. Since each security
results in different valuation indicators, valuations would have 3 objects
for company Eletrobrás.
Another point is that using YfinanceValuation is very slow. This is because
the library yfinance takes a while to retrieve the shares outstanding of a
company, which is required for calculation.
Examples
More elaborated examples of usage are in the directory samples:
python -m samples.financial '/path/to/dfp_or_itr.zip'
python -m samples.valuation '/path/to/dfp_or_itr.zip'
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyibr-0.1.1.tar.gz.
File metadata
- Download URL: pyibr-0.1.1.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fbc92f807ba19849a5f32d5265559cef340304caf4ee4c9ebd0717dcfb6d398
|
|
| MD5 |
fbad66b5a6d0a717a3a0957105647e1a
|
|
| BLAKE2b-256 |
1a5646393867fe46469df11f3c7d46ea300c0b3bbddb52b1870f24cecd776c02
|
File details
Details for the file pyibr-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pyibr-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9c36a52554bf3f1c248464ed43000c32533609670752f525f20c50f80400da9
|
|
| MD5 |
62656b7695f0db884c0a791d75b52469
|
|
| BLAKE2b-256 |
971e784c751b16fe67dfe676b867cdaf2cc23d102b951db48f1090ff1381c467
|