Skip to main content

magicformulabr - Script que implementa a magic formula de Joel Greenblatt para classificar empresas listadas na Bovespa.

Build and Test PyPI - Python Version GitHub License Code style: black

Detalhes sobre a estratégia Magic Formula pode ser encontrado no livro "The Little Book That Still Beats the Market" escrito por Joel Greenblatt.

O script consulta os dados das empresas no site http://fundamentus.com.br

O magicformulabr foi feito apenas para estudo, não é recomendação de investimento.

Instalação

pip install magicformulabr

Uso

O magicformulabr armazena os dados baixados em um arquivo local "data_cache.json" por 24 horas para evitar requisições desnecessárias. Use --force-update para atualizar os dados.

$ magicformulabr -h
usage: magicformulabr [-h] [-d] [-v] [-m {1,2,3}] [-t TOP] [--force-update]

Gera rank de acoes usando a magic formula

optional arguments:
  -h, --help            show this help message and exit
  -d, --debug           debug flag
  -v, --verbose         verbosity level
  -m {1,2,3}, --method {1,2,3}
                        Campos usados para o calculo da magic formula
  -t TOP, --top TOP     Numero de empresas para mostrar no rank
  --force-update        Forca a atualizacao do cache

    Methods disponiveis:
        1 - P/L e ROE
        2 - EV/EBIT e ROIC
        3 - EV/EBITDA e ROIC

    Exemplos de uso:
        magicformulabr -h
        magicformulabr -m 1
        magicformulabr -v
        magicformulabr -vv
        magicformulabr -m 3 -vv


$ magicformulabr -t 10 -v
    Papel  Cotação    P/L Div.Yield  EV/EBIT  EV/EBITDA   ROIC      ROE  Rank_earnings_yield  Rank_return_on_capital  Rank_Final
1   PSSA3    47.71   9.14     4,49%     0.33       0.33  56.48   18,83%                  1.0                     3.0         4.0
2   WIZS3     6.61   4.95    10,12%     1.92       1.71  80.94   60,60%                  4.0                     2.0         6.0
3   MRFG3    14.82   4.89     0,00%     3.64       3.11  29.77  223,61%                  5.0                     8.0        13.0
4   MNPR3     6.84  -3.39     0,00%     0.95       0.85  22.68    3,89%                  2.0                    18.0        20.0
5   BEEF3     9.63   6.40     3,11%     5.53       4.74  21.10   67,81%                 13.0                    21.0        34.0
6   GEPA4    38.49  15.04     4,90%     6.35       4.59  27.52   13,64%                 26.0                     9.0        35.0
7   GEPA3    39.00  15.24     4,84%     6.43       4.65  27.52   13,64%                 28.0                     9.0        37.0
8   BOBR4     2.24  15.17     0,00%     6.50       5.52  24.58  -15,94%                 30.0                    14.0        44.0
9   ATOM3     4.16   7.17     0,00%     7.46       7.43  84.60   73,56%                 47.0                     1.0        48.0
10  EQTL3    22.99   8.05     1,39%     6.14       5.47  16.32   29,69%                 18.0                    36.0        54.0

Metadata

Release files for magicformulabr 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for magicformulabr 0.2.1
File Size Uploaded Provenance Actions
magicformulabr-0.2.1.tar.gz 10.5 kB Without provenance Details for magicformulabr-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for magicformulabr 0.2.1
File Interpreter ABI Platform Actions
magicformulabr-0.2.1-py3-none-any.whl Python 3 none any Details for magicformulabr-0.2.1-py3-none-any.whl

Total release size: 19.6 kB

Release files / magicformulabr-0.2.1.tar.gz

Download URL magicformulabr-0.2.1.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d48367399214bb76215f429f43230cdd0916192ac1e89411aff8d5b045a8e636
BLAKE2b-256 checksum
How to use checksums
11d10a9acbd0b495d0983d53ef513c344167e54ee28330a0b3d278bcb9ade19f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.6

Release files / magicformulabr-0.2.1-py3-none-any.whl

Download URL magicformulabr-0.2.1-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cca4744e700a74d1085af8e7e07911f2fae09c194189dd3a93be38f245909db0
BLAKE2b-256 checksum
How to use checksums
eb70869b68901933a1fbb65cbe6d06b80f88e04a0313b48462315f0728bc5bb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.6

Security for magicformulabr 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page