Biblioteca Python para leitura e fetch do arquivo COTAHIST da B3. Suporta tanto pandas quanto polars como engines.
Project description
b3cotahist
Biblioteca Python para leitura e fetch do arquivo COTAHIST da B3. Suporta tanto pandas quanto polars como engines.
Instalação
pip install b3cotahist
Uso
Download direto da B3
import datetime
import b3cotahist
# Download dos dados do pregão de 01/03/2024
df = b3cotahist.get(
date=datetime.date(2024, 3, 1),
engine='pandas' # ou 'polars'
)
# Caso tenha problemas com SSL da b3
df = b3cotahist.get(
date=datetime.date(2024, 3, 1),
raise_ssl_error=True
)
Leitura de arquivos
df = b3cotahist.read_zip(path='COTAHIST_D20240301.ZIP')
df = b3cotahist.read_txt(path='COTAHIST_D20240301.TXT')
# Ou caso queira usar polars
df = b3cotahist.read_zip(path='COTAHIST_D20240301.ZIP', engine='polars')
Leitura de bytes
# Lendo a partir de bytes
with open('COTAHIST_D20240301.TXT', 'rb') as f:
dados = f.read()
df = b3cotahist.read_bytes(dados)
# Ou a partir de BytesIO
import io
bytes_io = io.BytesIO(dados)
df = b3cotahist.read_bytes(bytes_io)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
b3cotahist-0.1.6.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file b3cotahist-0.1.6.tar.gz
.
File metadata
- Download URL: b3cotahist-0.1.6.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5fd851276130799ff9d6aec051d686e572fd05f7088d367356a9396dfdca089 |
|
MD5 | 70eca8483095e3d0675d064ae58a2e4f |
|
BLAKE2b-256 | e03d9b8ea9cb17d13472e9c9739bd9c755122a83a147413becd831378c446262 |
File details
Details for the file b3cotahist-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: b3cotahist-0.1.6-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6a6178bbbd3dba260114a6b4c68908bd8e0b32c2b7004dc86661a66be673d00 |
|
MD5 | df0935156677304e947250aefa86b66c |
|
BLAKE2b-256 | 57399930bab7cce5947cc39e12ece08a7a61b83cc5bdbb44ad79954b17d0ac7d |