Git Product home page Git Product logo

bancocentralbrasil's Introduction

Banco Central do Brasil

bancocentralbrasil codecov

Sobre

  • Informações sobre taxas oficiais diárias de Inflação, Selic, Poupança, Dólar, Dólar PTAX, Euro e Euro PTAX pelo site do Banco Central do Brasil (http://www.bcb.gov.br).

Desenvolvimento

$ virtualenv .venv
$ source .venv/bin/activate

Instalação das dependências

$ pip install -r requirements.txt

Instalação

$ ./setup.py install

Utilização

$ python ./sample.py
nflação Meta: 3.75
Inflação acumulada 12 últimos meses: 8.99
Poupança: 0.3012
Dólar compra PTAX: 5.4174
Dólar venda PTAX: 5.418
Dólar PTAX em 19/08/2021 16:07:17
Dólar compra: 5.4174
Dólar venda: 5.418
Dólar em 19/08/2021 16:07:17
Euro compra PTAX: 6.3335
Euro venda PTAX: 6.3364
Euro PTAX em 19/08/2021 16:07:17
Euro compra: 6.3335
Euro venda: 6.3364
Euro em 19/08/2021 16:07:17
Selic meta: 5.25 em 04/08/2021
Selic real: 5.15 em 19/08/2021
>>> from bc.bancocentral import Inflacao
>>> inflacao = Inflacao()
>>> print('%s' % inflacao.get_acumulada_tax())
4.53
>>> from bc.bancocentral import Selic
>>> selic = bancocentral.Selic()
>>> selic.get_selic_meta()
6.5

Testes e cobertura

$ python -m unittest
..............................
----------------------------------------------------------------------
Ran 30 tests in 47.580s

OK
$ python -m coverage run --source=bc tests/test_bancocentral.py
..............................
----------------------------------------------------------------------
Ran 30 tests in 64.135s

OK
$ coverage report
$ coverage html

Licença

Licença MIT

bancocentralbrasil's People

Contributors

agrezende avatar deepsourcebot avatar denisgermano avatar diegoponciano avatar leogregianin avatar pyup-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bancocentralbrasil's Issues

Problemas p/ executar. Python 2.7

Olá conforme conversamos, estou formalizando o problema que tive de execução com o python 2.7
instalei o python 3.x deu certo.

Métodos usados para correção:

apt-get install python3
apt-get install python3-pip
python3 -m pip install -r requirements.txt

Issue corrigido, obrigado.

(PTC-W0063) Unguarded next inside generator

Description

Calls to next() should be inside try-except block. <!--more--> When the iterator is exhausted, StopIteration exception is raised. When used inside a generator, this can cause unexpected behavior. If not handled, it will propagate out of the generator causing termination. PEP-479 has been accepted to fix this problem. It will …

Occurrences

There is 1 occurrence of this issue in the repository.

See all occurrences on DeepSource → deepsource.io/gh/open-bacen/bancocentralbrasil/issue/PTC-W0063/occurrences/

computer locked

Hello, have u ever get this message?

"Prezado Cliente, o acesso desse computador foi bloqueado por identificarmos fragilidade de segurança no equipamento. Para regularizar o acesso nessa máquina, será necessário efetuar a formatação completa e alterar suas senhas.Providencie as cópias de segurança dos seus arquivos e procure um técnico de confiança para o procedimento de formatação."

Parciais da PTAX

Bom dia!
É possível coletar as parciais de uma data específica da PTAX por horário, conforme abaixo:

image

Obrigado e parabéns pelo trabalho!
Abraço,
Davi

(PYL-W0105) Unassigned string statement

Description

The string statement has not been assigned to anything. This is pointless and should be removed if not necessary. In case this is supposed to describe what's happening in the code, it is recommended to use comments or docstrings instead. #### Not preferred: ```python 'Define a function to add 2 …

Occurrences

There are 8 occurrences of this issue in the repository.

See all occurrences on DeepSource → deepsource.io/gh/open-bacen/bancocentralbrasil/issue/PYL-W0105/occurrences/

Problemas

E ai galera, otima iniciativa de voces em criar esta biblioteca. Porém estou tento problemas para importar o dados de vocês.

Tentei como "bancocentral", "bancocentralbrasil", porém não obtive sucesso.
image

Usar API XML ou JSON ao invés do feed RSS

Olá. Parabéns pelo projeto, estou usando para atualizar cotação do dólar. Seria interessante disponibilizar outros índices como IGP-M que estão disponíveis via API. Tem um vídeo explicando como acessar essa API usando um módulo Python chamado panda: https://ricospeloacaso.com.br/como-acessar-a-base-de-dados-do-banco-central-do-brasil-com-python-python-para-investimentos-10/

Seria interessante usar este método de busca das informações pois assim é possível obter muitos outros indicadores econômicos que são gerados ou consolidados pelo Banco Central.

links

Vcs lembra como conseguiu os links para os dados?
http://servicos.albertino.eti.br/
Nesse site o cara fez um webservice para disponibilizar dados.
Mas esse seu parece que não é leitura de tela.
Att

Handle integer values

The code breaks when the value returned is an integer, I mean, if it has no comma:

$ python sample.py 
Inflação Meta: 4,5
Inflação acumulada 12 últimos meses: 2,8
Poupança: 0,3994
Dólar compra: 3,3048
Dólar venda: 3,3054
Traceback (most recent call last):
  File "sample.py", line 18, in <module>
    print(u'Selic meta: %s' % selic.get_selic_meta())
  File "/home/israelst/projects/bancocentralbrasil/bancocentral.py", line 96, in get_selic_meta
    selic_meta = re.search('<div id=label>Meta:</div><div id=rate><div id=ratevalue>(\d+,\d+)</div>', selic).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

"AttributeError" na recuperação de taxas

As consultas às páginas do BACEN utilizadas neste projeto ora retornam valores com "," (vírgula), ora com "." (ponto), como em 1,90 ou 1.90. A cada "refresh" de uma determinada página (ou a cada execução do código), não é determinístico o retorno de valores com ponto ou com vírgula.
Quando o valor retornado possui "." (ponto), as expressões regulares não darão "match", e irão resultar na exceção 'AttributeError' (pois a propriedade 'group' não estará definida).

/usr/local/lib/python3.7/dist-packages/bc/bancocentral.py in get_acumulada_tax(self)
     60     def get_acumulada_tax(self):
     61         inflacao = cleanContent(self.req.content.decode('utf-8'))
---> 62         tax = re.search(r'<div id=label>Acumulada</div><div id=rate><div id=value>(\d*\,?\d+)</div>', inflacao).group(1)
     63         return float(tax.replace(',','.'))
     64 

AttributeError: 'NoneType' object has no attribute 'group'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.