Download and process Brazilian companies' financial data directly from CVM. [Em português]
No installation required, just download the latest released executable. Then open a terminal (CMD on Windows) and run the commands shown below.
For the first time, run the following command:
./rapina get
Then, to get a company report, together with a summary for the companies from the same sector:
./rapina report <company>
./rapina get [-s]
It downloads all files from CVM web server, parses their contents and stores on a sqlite database at .data/rapina.db
.
This command must be run at least once before you run the other commands.
-s, --sectors Download and sector classification for companies listed at B3
Used to get only a summary for the other companies from the same sector.
./rapina list
./rapina report [flags] company_name
A spreadsheet with the financial data will be created and, on another sheet, the summary of all companies in the same sector.
The sector list is obtained from B3 and saved in the sector.yml
file (via get -s
command). If you want to change the sector grouping, just edit this file.
-d, --outputDir string Output directory [default: ./reports]
-s, --scriptMode Does not show companies list; uses the most similar
company name
On Linux or macOS, use the arrow keys to navigate through the companies list. On Windows, use j and k.
./rapina report WEG
The spreadsheet will be saved at ./reports
./rapina report "TEC TOY" -s -d /tmp/output
The spreadsheet will be saved at /tmp/output
Some Linux distributions (e.g. Fedora 34) might face some issues regarding the signer authority (Global Sign) that B3 is using on its SSL certificates. In case of x509: certificate signed by unknown authority
error, one should manually import the Root CA certificate into the O.S. trusted database:
Fedora 34 / CentOS
-
Download the Issuer Root Cert
curl http://secure.globalsign.com/cacert/gsrsaovsslca2018.crt > /tmp/global-signer.der
-
Convert from .der to .pem
openssl x509 -inform der -in /tmp/global-signer.der -out /tmp/globalsignroot.pem
-
Move the .pem file to the anchors folder
sudo cp /tmp/globalsignroot.pem /usr/share/pki/ca-trust-source/anchors/
-
Update the trusted certificates database
sudo update-ca-trust
Ubuntu
-
Download the Issuer Root Cert
curl https://secure.globalsign.net/cacert/Root-R1.crt > /tmp/GlobalSign_Root_CA.crt
curl https://secure.globalsign.net/cacert/Root-R2.crt > /tmp/GlobalSign_Root_CA_R2.crt
-
Move the .crt files to the certificates folder
sudo cp /tmp/GlobalSign_Root_CA.crt /usr/local/share/ca-certificates/
sudo cp /tmp/GlobalSign_Root_CA_R2.crt /usr/local/share/ca-certificates/
-
Update the trusted certificates database
sudo update-ca-trust
If you want to compile your own executable, you need first to download and install the Go compiler. Then follow these steps:
go get github.com/dude333/rapina
cd $GOPATH/src/github.com/dude333/rapina
- Change to the cli directory (
cd cli
) - Compile using the Makefile (
make
). To cross compile for Windows on Linux, usemake win
.
- Fork it
cd $GOPATH/src/github.com/your_username
- Download your fork to your PC (
git clone https://github.com/your_username/rapina && cd rapina
) - Create your feature branch (
git checkout -b my-new-feature
) - Make changes and add them (
git add .
) - Commit your changes (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new pull request
MIT