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.

Instalação

pip install b3cotahist

Uso

Fetch da B3

import datetime
import b3cotahist

# Fetch dos dados do pregão de 01/03/2024

date = datetime.date(2024, 3, 1)

df = b3cotahist.get(date)

# Caso tenha problemas com SSL da b3
df = b3cotahist.get(date, raise_ssl_error=False)

# A B3 também disponibiliza dados consolidados por ano
df = b3cotahist.get_year(2024)

Leitura de arquivos

df = b3cotahist.read_zip(path='COTAHIST_D20240301.ZIP')

df = b3cotahist.read_txt(path='COTAHIST_D20240301.TXT')

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.9.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

b3cotahist-0.1.9-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file b3cotahist-0.1.9.tar.gz.

File metadata

  • Download URL: b3cotahist-0.1.9.tar.gz
  • Upload date:
  • Size: 4.8 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.9.tar.gz
Algorithm Hash digest
SHA256 e4793484cbfbd5de736ae8fb7e252758668ee549dd7ed87ff763d67729fb1a7c
MD5 a7392b775a53b914cd7adf59ef830aa2
BLAKE2b-256 d7047054203c1df53770c9189de4e7f598213f41bc07a48ecd22d443fc1246ef

See more details on using hashes here.

File details

Details for the file b3cotahist-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: b3cotahist-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d962dd8a7ab703d03453e8a63b5a863af6b42f509310b4df55e348d9cde9dfb8
MD5 f1e14cb3bf74bd3970c64dea0b8b5840
BLAKE2b-256 2a9e0763fb7318a38fd40a3de8ded12433203ce5d3ce0646b15e7978583a9168

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page