Skip to content

Commit 987ece8

Browse files
committed
Updated documentation
1 parent 7c9a461 commit 987ece8

10 files changed

Lines changed: 87 additions & 59 deletions

File tree

60.8 KB
Loading
73 KB
Loading
50.4 KB
Loading

docs/conf.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212

1313
import os
1414
import sys
15-
sys.path.insert(0, os.path.abspath('..'))
15+
16+
sys.path.insert(0, os.path.abspath(".."))
1617

1718

1819
# -- Project information -----------------------------------------------------
1920

20-
project = 'python-bcb'
21-
copyright = '2021, Wilson Freitas'
22-
author = 'Wilson Freitas'
21+
project = "python-bcb"
22+
copyright = "2021, Wilson Freitas"
23+
author = "Wilson Freitas"
2324

2425
# The full version, including alpha/beta/rc tags
2526
# release = '0.1.7'
@@ -31,38 +32,35 @@
3132
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3233
# ones.
3334
extensions = [
34-
'sphinx.ext.autodoc',
35-
'sphinx.ext.autosummary',
36-
'sphinx.ext.intersphinx',
37-
'sphinx.ext.napoleon',
38-
'sphinx.ext.autosectionlabel',
39-
'IPython.sphinxext.ipython_directive',
40-
'IPython.sphinxext.ipython_console_highlighting',
41-
'matplotlib.sphinxext.plot_directive',
35+
"sphinx.ext.autodoc",
36+
"sphinx.ext.autosummary",
37+
"sphinx.ext.intersphinx",
38+
"sphinx.ext.napoleon",
39+
"sphinx.ext.autosectionlabel",
40+
"IPython.sphinxext.ipython_directive",
41+
"IPython.sphinxext.ipython_console_highlighting",
42+
"matplotlib.sphinxext.plot_directive",
4243
]
4344

44-
# Add any paths that contain templates here, relative to this directory.
45-
templates_path = ['_templates']
46-
4745
# The language for content autogenerated by Sphinx. Refer to documentation
4846
# for a list of supported languages.
4947
#
5048
# This is also used if you do content translation via gettext catalogs.
5149
# Usually you set "language" from the command line for these cases.
52-
language = 'pt_br'
50+
language = "pt_br"
5351

5452
# List of patterns, relative to source directory, that match files and
5553
# directories to ignore when looking for source files.
5654
# This pattern also affects html_static_path and html_extra_path.
57-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
55+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
5856

5957

6058
# -- Options for HTML output -------------------------------------------------
6159

6260
# The theme to use for HTML and HTML Help pages. See the documentation for
6361
# a list of builtin themes.
6462
#
65-
html_theme = 'pydata_sphinx_theme'
63+
html_theme = "pydata_sphinx_theme"
6664
html_theme_options = {
6765
"external_links": [],
6866
"github_url": "https://github.com/wilsonfreitas/python-bcb",
@@ -71,6 +69,8 @@
7169
# Add any paths that contain custom static files (such as style sheets) here,
7270
# relative to this directory. They are copied after the builtin static files,
7371
# so a file named "default.css" will overwrite the builtin "default.css".
74-
html_static_path = ['_static']
72+
html_static_path = ["_static"]
7573

7674
autosummary_generate = True
75+
76+
ipython_savefig_dir = "_static/images/savefig/"

docs/currency.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ O módulo ``currency`` obtem dados de moedas do conversor de moedas do Banco Cen
2727
2828
.. ipython:: python
2929
30+
@savefig currency1.png
3031
df.plot(figsize=(12, 6));
3132
32-
.. plot:: plots/currency1.py
33-
3433
3534
.. autofunction:: get_currency_list
3635

docs/index.rst

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
python-bcb
77
==========
88

9+
.. toctree::
10+
:maxdepth: 1
11+
:caption: Conteúdo:
12+
13+
sgs
14+
currency
15+
expectativas
16+
taxajuros
17+
odata
18+
api
19+
920
**python-bcb** é uma interface em Python estruturada para obter informações
1021
da API de dados abertos do `Banco Central do Brasil <https://www.bcb.gov.br>`_.
1122

@@ -76,18 +87,6 @@ Uso
7687
sgs.get(('IPCA', 433), last=12)
7788
7889
79-
80-
.. toctree::
81-
:maxdepth: 2
82-
:caption: Conteúdo:
83-
84-
sgs
85-
currency
86-
expectativas
87-
odata
88-
api
89-
90-
9190
Índices e tabelas
9291
==================
9392

docs/plots/currency1.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/plots/sgs1.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/sgs.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,5 @@ Função :ref:`bcb.sgs.get`
3838
plt.suptitle('IPCA acumulado 12 meses - Janela Móvel', fontsize=18)
3939
plt.xlabel('Data')
4040
plt.ylabel('%')
41+
@savefig sgs1.png
4142
plt.legend().set_visible(False)
42-
43-
.. plot:: plots/sgs1.py

docs/taxajuros.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Taxas de Juros
2+
##############
3+
4+
A API de taxas de juros de operações de crédito pode ser acessada através da
5+
classe :py:class:`bcb.TaxaJuros`.
6+
7+
.. _documentacao: https://olinda.bcb.gov.br/olinda/servico/TaxaJuros/versao/v1/documentacao
8+
9+
__ documentacao_
10+
11+
Os dados são obtidos a partir da `API de Taxas de Juros`__.
12+
13+
.. currentmodule:: bcb
14+
15+
16+
.. autoclass:: TaxaJuros
17+
:members:
18+
:inherited-members:
19+
20+
21+
Esta API tem os ``EntitySets``:
22+
23+
.. ipython:: python
24+
25+
from bcb import TaxaJuros
26+
em = TaxaJuros()
27+
em.describe()
28+
29+
As características do ``EntitySets`` podem ser visualizadas por:
30+
31+
.. ipython:: python
32+
33+
em.describe("TaxasJurosDiariaPorInicioPeriodo")
34+
35+
Vejamos um gráfico da mediana das taxas de juros do cheque especial praticada
36+
pelas instituições financeiras.
37+
38+
.. ipython:: python
39+
40+
import pandas as pd
41+
42+
ep = em.get_endpoint('TaxasJurosDiariaPorInicioPeriodo')
43+
df_cheque = (ep.query()
44+
.filter(ep.Segmento == 'PESSOA FÍSICA',
45+
ep.Modalidade == 'CHEQUE ESPECIAL - PRÉ-FIXADO')
46+
.collect())
47+
df_cheque['InicioPeriodo'] = pd.to_datetime(df_cheque['InicioPeriodo'])
48+
grp = df_cheque.groupby('InicioPeriodo')
49+
df_mean = grp.agg({'TaxaJurosAoMes': 'median'})
50+
51+
@savefig taxajuros1.png
52+
df_mean['TaxaJurosAoMes'].plot(figsize=(16,6), style='o', markersize=1,
53+
xlabel='Data', ylabel='Taxa',
54+
title='Médias das Taxas de Juros de Cheque Especial - Fonte:BCB');
55+

0 commit comments

Comments
 (0)