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'
Metadata
Release files for pyibr 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyibr-0.1.1.tar.gz | 26.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyibr-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.7 kB
Release files / pyibr-0.1.1.tar.gz
| Download URL | pyibr-0.1.1.tar.gz |
|---|---|
| Size | 26.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fbc92f807ba19849a5f32d5265559cef340304caf4ee4c9ebd0717dcfb6d398
|
|
BLAKE2b-256 checksum How to use checksums |
1a5646393867fe46469df11f3c7d46ea300c0b3bbddb52b1870f24cecd776c02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.1
|
Release files / pyibr-0.1.1-py3-none-any.whl
| Download URL | pyibr-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9c36a52554bf3f1c248464ed43000c32533609670752f525f20c50f80400da9
|
|
BLAKE2b-256 checksum How to use checksums |
971e784c751b16fe67dfe676b867cdaf2cc23d102b951db48f1090ff1381c467
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.1
|