Skip to main content

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

Project description

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 ) )
Links úteis
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

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

b3parser-0.1.7.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

b3parser-0.1.7-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file b3parser-0.1.7.tar.gz.

File metadata

  • Download URL: b3parser-0.1.7.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for b3parser-0.1.7.tar.gz
Algorithm Hash digest
SHA256 60d583182e21338aa3fbc9a724a7594afa324b0d5659d27b456d5518c93408c7
MD5 989505eae0e6a43aa08946667211f63d
BLAKE2b-256 dad5960102145b8f998d9bad3444e601c14ab32ef13b7814b7a4a923ea7a0223

See more details on using hashes here.

File details

Details for the file b3parser-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: b3parser-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for b3parser-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0de041c801f9748aaf754f3673479ec94a0796c9bbf99fcee49190639c0e803c
MD5 0833ae69b1e43f6692cc267fe0f18a56
BLAKE2b-256 575bdb71c08559de9188786d8fbb628e529242fdf6497783a347e08181c4edfe

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