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.5.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file b3cotahist-0.1.5.tar.gz
.
File metadata
- Download URL: b3cotahist-0.1.5.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 | 6c785f2af4a22ea65afd51e2ee974a238385563913c397d5b96ba48df9cb629a |
|
MD5 | 91eba186c511b2e754ce9a72579f3d24 |
|
BLAKE2b-256 | 60a40dcafed5ec9d93ab966cbe102cb15a9a981e75db1663636671a79a178130 |
File details
Details for the file b3cotahist-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: b3cotahist-0.1.5-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 | cca49c81d9515ba6e96ccaf5ff8a14e7130d5db1a9e8e35eb212d5a679560b4f |
|
MD5 | c1099d0ef10ddca59694ccb0de0dadea |
|
BLAKE2b-256 | 90834d66a27fabc6d368a627ba7958f9e1959f45faaf2efe2e6f0a31ebdccf80 |