This library was created to parse the txt files from BM&FBOVESPA/B3 site to a csv file or to an xlsx file.
You can either install by pip:
$ pip3 install bovespa2csv
or by cloning the repository on Github:
$ git clone git@github.com:felipessalvatore/bovespa2csv.git
$ cd bovespa2csv
$ pip3 install -r requirements.txt
You can use the script parse_file.py
to create a csv file:
$ cd bovespa2csv
$ python3 parse_file.py <txt_file> example.csv
or to create a xlsx file:
$ cd bovespa2csv
$ python3 parse_file.py -e <txt_file> example.xlsx
You can also use the class BovespaParser
to get a pandas DataFrame from the txt file:
from bovespa2csv.BovespaParser import BovespaParser
from bovespa2csv.util import get_df_from_b3_data
parser = BovespaParser()
parser.read_txt("COTAHIST_DXXXXXX.TXT")
df = get_df_from_b3_data(parser.df, ["ITUB4"]