Shows historical data from B3 (Brazilian Stock Exchange) in visual dashboards.
Composed of 4 parts:
-
B3loader: Golang REST API that loads backup files, parses and persists the data on a Influx database -
InfluxDB: Event database that persists stock information -
B3loader-front: React app for visualizing/uploading/importing data -
Grafana: (optional) Visualization tool that provides a dummy dashboard for visualizing the data in the database
- Docker compose
Clone this repository:
git clone https://github.com/marcelovcpereira/b3loader.gitReview the contents of example.env file and copy it to .env
Run:
make compose-upto automatically open the frontend afterwards. Or
docker compose up -din case you don't have python3 installed or even Make.
Then visit http://localhost:9000.
This will run the 4 apps, but with NO DATA.
B3 website provides a form for downloading historical data here. You can download the data by year. The file name has this format:
COTAHIST_A{YEAR}.ZIPFor example, the file with data from all 2023 year is:
COTAHIST_A2023.ZIPB3 provides files with data from 1986 until now.
Once you download a file, you have 2 options to make it available for the app:
- Move it to the
b3-loader/data/b3loader-datafolder.
or
- Open the frontend and use the Upload feature to send the file to the server - http://localhost:9000/upload
Once the file is inside the server, you have 2 options to load the data into the database:
-
Use CLI to call the import endpoint (see below)
-
Open the frontend and use the Import feature
Once the data is imported, you can search for stock values in the Home page of the frontend.
The b3loader is a REST API that accepts requests for loading data into the database.
The endpoint is:
http://localhost:8080/api/v1/quotes/file/{filename}/import
Where filename should be the name of a valid B3 Backup file located at {THIS_PROJECT_PATH}/data/b3loader-data. Example:
curl http://localhost:8080/api/v1/quotes/file/COTAHIST_A2024.ZIP/importYou can check the files that are available to be imported by either:
-
Calling the endpoint
http://localhost:8080/api/v1/quotes/file/list -
Visiting the frontend and using the Import feature
Visit http://localhost:9000 after running make compose-up
The influxdb data can be visualized directly if you visit:
http://localhost:8086And login with the user/pass that you defined in the .env file.
You can see an example dashboard if you visit grafana at:
http://localhost:3000


