pyibr


Namepyibr JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/glourencoffee/pyibr/
SummaryCalculates fundamental analysis indicators of Brazilian companies
upload_time2023-05-26 16:48:40
maintainer
docs_urlNone
authorGiovanni Lourenço
requires_python>=3.7
licenseMIT
keywords investment finances
VCS
bugtrack_url
requirements pycvm pybov yfinance
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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][repo-pycvm] 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:

```py
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][repo-pybov] and [yfinance][repo-yfinance]:

```py
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`:

```sh
python -m samples.financial '/path/to/dfp_or_itr.zip'
python -m samples.valuation '/path/to/dfp_or_itr.zip'
```

  [repo-pycvm]: <https://github.com/callmegiorgio/pycvm>
  [repo-pybov]: <https://github.com/callmegiorgio/pybov>
  [repo-yfinance]: <https://pypi.org/project/yfinance/>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/glourencoffee/pyibr/",
    "name": "pyibr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "investment,finances",
    "author": "Giovanni Louren\u00e7o",
    "author_email": "gvnl.developer@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/1a/56/46393867fe46469df11f3c7d46ea300c0b3bbddb52b1870f24cecd776c02/pyibr-0.1.1.tar.gz",
    "platform": null,
    "description": "# About\n\n`ibr` is a Python library that calculates fundamental analysis indicators\nof Brazilian companies registered at CVM.\n\nThe reason for creating this library is that CVM things must belong to\nthe [cvm][repo-pycvm] library, whereas fundamental analysis indicators,\ninsofar they are something greater than CVM, should be separated.\n\nMoreover, valuation indicators depend on market data, which is beyond\nCVM's responsibility, since CVM is not a stock exchange.\n\n# Usage\n\n## Financial Indicators\n\nThe code below opens a DFP/ITR document and shows financial\nindicators of companies in that document:\n\n```py\nimport ibr\n\nfor result in ibr.reader('/path/to/dfp_or_itr.zip', (ibr.Indebtedness, ibr.Profitability, ibr.Efficiency)):\n    indebtedness, profitability, efficiency = result.indicators\n\n    print('----------------------------')\n    print('Company:', result.dfpitr.company_name)\n    \n    print('\\nIndebtedness:')\n    print(indebtedness)\n    \n    print('\\nEfficiency:')\n    print(efficiency)\n    \n    print('\\nProfitability:')\n    print(profitability)\n```\n\n## Valuation Indicators\n\nAs for valuation indicators, they need market data. Since market data is\nnot provided in a DFP/ITR file, because this is beyond CVM's scope, such\ndata must be obtained from the internet or some other source.\n\nFor that, the library `ibr` provides a class `YfinanceValuation`, which\nis based on the libraries [b3][repo-pybov] and [yfinance][repo-yfinance]:\n\n```py\nimport ibr\n\nfor result in ibr.reader('/path/to/dfp_or_itr.zip', [ibr.YfinanceValuation]):\n    print('------------------')\n    print('Company:', result.dfpitr.company_name)\n    \n    valuations = result.indicators[0]\n\n    for valuation in valuations:\n        print('\\nValuation:')\n        print(valuation)\n```\n\nNote that valuation indicators return a list, because it is possible that\na company has more than one security. An example is the company Eletrobr\u00e1s,\nwhich has three securities on B3: ELET3, ELET5 e ELET6. Since each security\nresults in different valuation indicators, `valuations` would have 3 objects\nfor company Eletrobr\u00e1s.\n\nAnother point is that using `YfinanceValuation` is very slow. This is because\nthe library `yfinance` takes a while to retrieve the shares outstanding of a\ncompany, which is required for calculation.\n\n## Examples\n\nMore elaborated examples of usage are in the directory `samples`:\n\n```sh\npython -m samples.financial '/path/to/dfp_or_itr.zip'\npython -m samples.valuation '/path/to/dfp_or_itr.zip'\n```\n\n  [repo-pycvm]: <https://github.com/callmegiorgio/pycvm>\n  [repo-pybov]: <https://github.com/callmegiorgio/pybov>\n  [repo-yfinance]: <https://pypi.org/project/yfinance/>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Calculates fundamental analysis indicators of Brazilian companies",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/glourencoffee/pyibr/"
    },
    "split_keywords": [
        "investment",
        "finances"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "971e784c751b16fe67dfe676b867cdaf2cc23d102b951db48f1090ff1381c467",
                "md5": "62656b7695f0db884c0a791d75b52469",
                "sha256": "f9c36a52554bf3f1c248464ed43000c32533609670752f525f20c50f80400da9"
            },
            "downloads": -1,
            "filename": "pyibr-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "62656b7695f0db884c0a791d75b52469",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8223,
            "upload_time": "2023-05-26T16:48:37",
            "upload_time_iso_8601": "2023-05-26T16:48:37.975056Z",
            "url": "https://files.pythonhosted.org/packages/97/1e/784c751b16fe67dfe676b867cdaf2cc23d102b951db48f1090ff1381c467/pyibr-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a5646393867fe46469df11f3c7d46ea300c0b3bbddb52b1870f24cecd776c02",
                "md5": "fbad66b5a6d0a717a3a0957105647e1a",
                "sha256": "5fbc92f807ba19849a5f32d5265559cef340304caf4ee4c9ebd0717dcfb6d398"
            },
            "downloads": -1,
            "filename": "pyibr-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "fbad66b5a6d0a717a3a0957105647e1a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 26438,
            "upload_time": "2023-05-26T16:48:40",
            "upload_time_iso_8601": "2023-05-26T16:48:40.101031Z",
            "url": "https://files.pythonhosted.org/packages/1a/56/46393867fe46469df11f3c7d46ea300c0b3bbddb52b1870f24cecd776c02/pyibr-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-26 16:48:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "glourencoffee",
    "github_project": "pyibr",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pycvm",
            "specs": [
                [
                    ">=",
                    "0.3.2"
                ]
            ]
        },
        {
            "name": "pybov",
            "specs": [
                [
                    ">=",
                    "0.1.1"
                ]
            ]
        },
        {
            "name": "yfinance",
            "specs": []
        }
    ],
    "lcname": "pyibr"
}
        
Elapsed time: 0.07568s