Skip to main content

Package for web-scrapping companies from B3Bovespa

Project description

B3Bovespa

This repository scraps all the companies listed on the Bovespa B3 using Selenium.

Drivers

To allow web scrapping, it is necessary to download the driver accordingly to your preferred browser. Currently, the only supported browsers are Chrome and Firefox.

It is necessary that the driver's version is compatible with the current version of the installed browser.

Installation

The package could be installed via pip

pip install b3bovespa

It will install as dependencies Selenium (used for the web scrapping), Pandas (used to handle the output data) and tqdm (used for progress tracking).

Usage

B3Bovespa package is based on the B3Scrapper class, which will control the web scrapping of the Bovespa website. The web-scrapping is really straight-forward, you will need to instantiate a B3Bovespa object, passing the path of the browser driver (as discussed in here), the chosen driver (B3Bovespa supports both Firefox and Chrome) and the output path to export the company list on a CSV format.

from b3bovespa import B3Scrapper

DRIVER_PATH = 'path/to/drive'
b3 = B3Scrapper(path=DRIVER_PATH, browser="Chrome", output_path="/usr/companies/")

With the B3Scrapper object, it is simple to get the information from all the companies listed on Bovespa, a simple call to get_companies_data() will return a Pandas Dataframe containing all the info.

The get_companies_data() will also save a csv file containing all the information on the output path given to the object. If no output path was given, it will just save a csv file on the file directory.

companies = b3.get_companies_data()

If necessary, it is possible to close the current session of the driver by calling the close() method.

b3.close()

Change Log

[0.1] - 2020-08-18

  • Creating the base code for web scrapping
  • Adding Chrome and Firefox support
  • Adding B3Bovespa as base website for scrapping
  • Adding tqdm progress bar to keep track

[0.1.1] - 2020-08-20

  • Bug fixes: fixing broken import

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

B3Bovespa-0.1.1.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

B3Bovespa-0.1.1-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page