Skip to main content

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


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)

Uploaded Source

Built Distribution

b3cotahist-0.1.5-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

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

Hashes for b3cotahist-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6c785f2af4a22ea65afd51e2ee974a238385563913c397d5b96ba48df9cb629a
MD5 91eba186c511b2e754ce9a72579f3d24
BLAKE2b-256 60a40dcafed5ec9d93ab966cbe102cb15a9a981e75db1663636671a79a178130

See more details on using hashes here.

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

Hashes for b3cotahist-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cca49c81d9515ba6e96ccaf5ff8a14e7130d5db1a9e8e35eb212d5a679560b4f
MD5 c1099d0ef10ddca59694ccb0de0dadea
BLAKE2b-256 90834d66a27fabc6d368a627ba7958f9e1959f45faaf2efe2e6f0a31ebdccf80

See more details on using hashes here.

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