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.4.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file b3cotahist-0.1.4.tar.gz
.
File metadata
- Download URL: b3cotahist-0.1.4.tar.gz
- Upload date:
- Size: 4.0 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 | 7c4e305732f989942ad6d5d4b7712fef9f47d442b404a6a0eace614dd614bb60 |
|
MD5 | ed620f6037e1f24090630205e6c3de8c |
|
BLAKE2b-256 | 838e6ba46c67e8f449c6984d1933a078ea06ca0001c914e1b971a2e43b62e06c |
File details
Details for the file b3cotahist-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: b3cotahist-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.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 | bbab41bae5ef1b94cbfaa7571a2e02ddee167960821074955eb0b51dc7d5bd98 |
|
MD5 | 4d74cd1911add43ece72b1d2f37aec77 |
|
BLAKE2b-256 | 9a2a03adc7544373bd99b6cc51fd77369ce90d36afcc237deb462bbbd9e5b9af |