Skip to main content

B3Parser

Um parser para os arquivos de histórico de cotações da B3

Exemplo de utilização (main.py)
from b3parser import B3Parser

if __name__ == '__main__':
    cols_sel = [
        'data_pregao',
        'cod_bdi',
        'cod_papel',
        'tp_merc',
        'nome_resum',
        'espec_papel',
        'preco_ultimo',
        'fator_cotacao',
    ]

    cods_bdi = [
        '02',  # LOTE PADRÃO
        '12',  # FUNDOS IMOBILIÁRIOS
        '96',  # FRACIONÁRIO
    ]

    tps_merc = [
        '010',  # VISTA
        '020',  # FRACIONÁRIO
    ]

    filtros = {
       'cod_bdi': ( 'in', cods_bdi ),
       'tp_merc': ( 'in', tps_merc ),
    }

    ano = 2015

    parser = B3Parser( 'data/COTAHIST_A{0}.TXT'.format( ano ) )

    parser.ler_arquivo( cols_sel = cols_sel, filtros = filtros )

    parser.exportar_json( 'data/{0}.json'.format( ano ) )
    #parser.exportar_sql( 'data/{0}.sql'.format( ano ) )
    #parser.exportar_csv( 'data/{0}.csv'.format( ano ) )
Dependências
Cotações históricas
Arquivos de cotações históricas
  • Anuais: Formato COTAHIST_AAAAA.ZIP
  • Mensais (últimos 12 meses): Formato COTAHIST_MMMAAAA.ZIP
  • Diárias (ano corrente): Formato COTAHIST_DDDMMAAAA.ZIP
Títulos negociáveis
Projetos similares no GitHub

Metadata

Release files for b3parser 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for b3parser 0.1.7
File Size Uploaded Provenance
b3parser-0.1.7.tar.gz 10.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for b3parser 0.1.7
File Interpreter ABI Platform
b3parser-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 22.9 kB

Release files / b3parser-0.1.7.tar.gz

Download URL b3parser-0.1.7.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
60d583182e21338aa3fbc9a724a7594afa324b0d5659d27b456d5518c93408c7
BLAKE2b-256 checksum
How to use checksums
dad5960102145b8f998d9bad3444e601c14ab32ef13b7814b7a4a923ea7a0223
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / b3parser-0.1.7-py3-none-any.whl

Download URL b3parser-0.1.7-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0de041c801f9748aaf754f3673479ec94a0796c9bbf99fcee49190639c0e803c
BLAKE2b-256 checksum
How to use checksums
575bdb71c08559de9188786d8fbb628e529242fdf6497783a347e08181c4edfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Security for b3parser 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page