python-bcb 0.3.3__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_bcb-0.3.3 → python_bcb-0.3.4}/PKG-INFO +7 -3
- {python_bcb-0.3.3 → python_bcb-0.3.4}/README.md +2 -0
- {python_bcb-0.3.3 → python_bcb-0.3.4}/bcb/__init__.py +7 -0
- {python_bcb-0.3.3 → python_bcb-0.3.4}/bcb/currency.py +66 -30
- python_bcb-0.3.4/bcb/exceptions.py +22 -0
- {python_bcb-0.3.3 → python_bcb-0.3.4}/bcb/odata/api.py +66 -32
- {python_bcb-0.3.3 → python_bcb-0.3.4}/bcb/odata/framework.py +140 -121
- {python_bcb-0.3.3 → python_bcb-0.3.4}/bcb/sgs/__init__.py +37 -22
- {python_bcb-0.3.3 → python_bcb-0.3.4}/bcb/sgs/regional_economy.py +14 -4
- {python_bcb-0.3.3 → python_bcb-0.3.4}/bcb/utils.py +8 -6
- {python_bcb-0.3.3 → python_bcb-0.3.4}/pyproject.toml +23 -2
- {python_bcb-0.3.3 → python_bcb-0.3.4}/LICENSE +0 -0
- {python_bcb-0.3.3 → python_bcb-0.3.4}/bcb/odata/__init__.py +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: python-bcb
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary:
|
|
5
|
+
License-File: LICENSE
|
|
5
6
|
Author: wilsonfreitas
|
|
6
7
|
Author-email: wilson.freitas@gmail.com
|
|
7
8
|
Requires-Python: >=3.10
|
|
@@ -9,10 +10,11 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
10
|
Classifier: Programming Language :: Python :: 3.10
|
|
10
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
15
|
Requires-Dist: httpx (>=0.24.0)
|
|
13
16
|
Requires-Dist: lxml (>=4.9.2)
|
|
14
17
|
Requires-Dist: pandas (>=2.0.0)
|
|
15
|
-
Requires-Dist: requests (>=2.31.0)
|
|
16
18
|
Description-Content-Type: text/markdown
|
|
17
19
|
|
|
18
20
|
# python-bcb
|
|
@@ -22,6 +24,8 @@ da API de dados abertos do [Banco Central do Brasil](https://www.bcb.gov.br).
|
|
|
22
24
|
|
|
23
25
|
[](https://pypi.python.org/pypi/python-bcb/)
|
|
24
26
|
[](https://pypi.python.org/pypi/python-bcb/)
|
|
27
|
+

|
|
28
|
+

|
|
25
29
|

|
|
26
30
|
|
|
27
31
|
|
|
@@ -5,6 +5,8 @@ da API de dados abertos do [Banco Central do Brasil](https://www.bcb.gov.br).
|
|
|
5
5
|
|
|
6
6
|
[](https://pypi.python.org/pypi/python-bcb/)
|
|
7
7
|
[](https://pypi.python.org/pypi/python-bcb/)
|
|
8
|
+

|
|
9
|
+

|
|
8
10
|

|
|
9
11
|
|
|
10
12
|
|
|
@@ -2,13 +2,14 @@ import re
|
|
|
2
2
|
import warnings
|
|
3
3
|
from datetime import date, timedelta
|
|
4
4
|
from io import BytesIO, StringIO
|
|
5
|
-
from typing import List, Union
|
|
5
|
+
from typing import List, Optional, Union
|
|
6
6
|
|
|
7
|
+
import httpx
|
|
7
8
|
import numpy as np
|
|
8
9
|
import pandas as pd
|
|
9
|
-
import requests
|
|
10
10
|
from lxml import html
|
|
11
11
|
|
|
12
|
+
from .exceptions import BCBAPIError, CurrencyNotFoundError
|
|
12
13
|
from .utils import Date, DateInput
|
|
13
14
|
|
|
14
15
|
"""
|
|
@@ -16,44 +17,58 @@ O módulo :py:mod:`bcb.currency` tem como objetivo fazer consultas no site do co
|
|
|
16
17
|
"""
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
def _currency_url(currency_id:
|
|
20
|
+
def _currency_url(currency_id: int, start_date: DateInput, end_date: DateInput) -> str:
|
|
20
21
|
start_date = Date(start_date)
|
|
21
22
|
end_date = Date(end_date)
|
|
22
|
-
|
|
23
|
-
"https://ptax.bcb.gov.br/ptax_internet/consultaBoletim.do?"
|
|
24
|
-
"method=gerarCSVFechamentoMoedaNoPeriodo&"
|
|
25
|
-
"ChkMoeda={}&DATAINI={:%d/%m/%Y}&DATAFIM={:%d/%m/%Y}"
|
|
23
|
+
return (
|
|
24
|
+
f"https://ptax.bcb.gov.br/ptax_internet/consultaBoletim.do?"
|
|
25
|
+
f"method=gerarCSVFechamentoMoedaNoPeriodo&"
|
|
26
|
+
f"ChkMoeda={currency_id}&DATAINI={start_date.date:%d/%m/%Y}&DATAFIM={end_date.date:%d/%m/%Y}"
|
|
26
27
|
)
|
|
27
|
-
return url.format(currency_id, start_date.date, end_date.date)
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
_CACHE: dict[str, pd.DataFrame] = dict()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def clear_cache() -> None:
|
|
34
|
+
"""Clear the module-level session cache.
|
|
35
|
+
|
|
36
|
+
:func:`get` and :func:`get_currency_list` cache the currency ID list and
|
|
37
|
+
the full currency master table for the duration of the Python session so
|
|
38
|
+
that repeated calls do not make redundant HTTP requests. Call this
|
|
39
|
+
function to force a fresh fetch on the next request (useful in tests or
|
|
40
|
+
long-running scripts where the master data may have changed).
|
|
41
|
+
"""
|
|
42
|
+
_CACHE.clear()
|
|
31
43
|
|
|
32
44
|
|
|
33
45
|
def _currency_id_list() -> pd.DataFrame:
|
|
34
|
-
if
|
|
35
|
-
return
|
|
46
|
+
if _CACHE.get("TEMP_CURRENCY_ID_LIST") is not None:
|
|
47
|
+
return _CACHE.get("TEMP_CURRENCY_ID_LIST")
|
|
36
48
|
else:
|
|
37
|
-
url1 =
|
|
38
|
-
|
|
49
|
+
url1 = (
|
|
50
|
+
"https://ptax.bcb.gov.br/ptax_internet/consultaBoletim.do?"
|
|
51
|
+
"method=exibeFormularioConsultaBoletim"
|
|
52
|
+
)
|
|
53
|
+
res = httpx.get(url1, follow_redirects=True)
|
|
39
54
|
if res.status_code != 200:
|
|
40
55
|
msg = f"BCB API Request error, status code = {res.status_code}"
|
|
41
|
-
raise
|
|
56
|
+
raise BCBAPIError(msg, res.status_code)
|
|
42
57
|
|
|
43
58
|
doc = html.parse(BytesIO(res.content)).getroot()
|
|
44
59
|
xpath = "//select[@name='ChkMoeda']/option"
|
|
45
60
|
x = [(elm.text, elm.get("value")) for elm in doc.xpath(xpath)]
|
|
46
61
|
df = pd.DataFrame(x, columns=["name", "id"])
|
|
47
62
|
df["id"] = df["id"].astype("int32")
|
|
48
|
-
|
|
63
|
+
_CACHE["TEMP_CURRENCY_ID_LIST"] = df
|
|
49
64
|
return df
|
|
50
65
|
|
|
51
66
|
|
|
52
|
-
def _get_valid_currency_list(_date: date, n: int = 0) ->
|
|
67
|
+
def _get_valid_currency_list(_date: date, n: int = 0) -> httpx.Response:
|
|
53
68
|
url2 = f"http://www4.bcb.gov.br/Download/fechamento/M{_date:%Y%m%d}.csv"
|
|
54
69
|
try:
|
|
55
|
-
res =
|
|
56
|
-
except
|
|
70
|
+
res = httpx.get(url2, follow_redirects=True)
|
|
71
|
+
except httpx.ConnectError as ex:
|
|
57
72
|
if n >= 3:
|
|
58
73
|
raise ex
|
|
59
74
|
return _get_valid_currency_list(_date, n + 1)
|
|
@@ -73,8 +88,8 @@ def get_currency_list() -> pd.DataFrame:
|
|
|
73
88
|
DataFrame :
|
|
74
89
|
Tabela com a listagem de moedas disponíveis.
|
|
75
90
|
"""
|
|
76
|
-
if
|
|
77
|
-
return
|
|
91
|
+
if _CACHE.get("TEMP_FILE_CURRENCY_LIST") is not None:
|
|
92
|
+
return _CACHE.get("TEMP_FILE_CURRENCY_LIST")
|
|
78
93
|
else:
|
|
79
94
|
res = _get_valid_currency_list(date.today())
|
|
80
95
|
df = pd.read_csv(StringIO(res.text), delimiter=";")
|
|
@@ -92,7 +107,7 @@ def get_currency_list() -> pd.DataFrame:
|
|
|
92
107
|
df["country_code"] = df["country_code"].astype("int32")
|
|
93
108
|
df["code"] = df["code"].astype("int32")
|
|
94
109
|
df["symbol"] = df["symbol"].str.strip()
|
|
95
|
-
|
|
110
|
+
_CACHE["TEMP_FILE_CURRENCY_LIST"] = df
|
|
96
111
|
return df
|
|
97
112
|
|
|
98
113
|
|
|
@@ -100,13 +115,21 @@ def _get_currency_id(symbol: str) -> int:
|
|
|
100
115
|
id_list = _currency_id_list()
|
|
101
116
|
all_currencies = get_currency_list()
|
|
102
117
|
x = pd.merge(id_list, all_currencies, on=["name"])
|
|
103
|
-
|
|
118
|
+
matches = x.loc[x["symbol"] == symbol, "id"]
|
|
119
|
+
if matches.empty:
|
|
120
|
+
raise CurrencyNotFoundError(f"Unknown currency symbol: {symbol}")
|
|
121
|
+
return int(matches.max())
|
|
104
122
|
|
|
105
123
|
|
|
106
|
-
def _get_symbol(
|
|
107
|
-
|
|
124
|
+
def _get_symbol(
|
|
125
|
+
symbol: str, start_date: DateInput, end_date: DateInput
|
|
126
|
+
) -> Optional[pd.DataFrame]:
|
|
127
|
+
try:
|
|
128
|
+
cid = _get_currency_id(symbol)
|
|
129
|
+
except CurrencyNotFoundError:
|
|
130
|
+
return None
|
|
108
131
|
url = _currency_url(cid, start_date, end_date)
|
|
109
|
-
res =
|
|
132
|
+
res = httpx.get(url, follow_redirects=True)
|
|
110
133
|
|
|
111
134
|
if res.headers["Content-Type"].startswith("text/html"):
|
|
112
135
|
doc = html.parse(BytesIO(res.content)).getroot()
|
|
@@ -115,12 +138,14 @@ def _get_symbol(symbol: str, start_date: DateInput, end_date: DateInput) -> pd.D
|
|
|
115
138
|
x = elm.text
|
|
116
139
|
x = re.sub(r"^\W+", "", x)
|
|
117
140
|
x = re.sub(r"\W+$", "", x)
|
|
118
|
-
msg = "BCB API returned error: {} - {}"
|
|
141
|
+
msg = f"BCB API returned error: {x} - {symbol}"
|
|
119
142
|
warnings.warn(msg)
|
|
120
143
|
return None
|
|
121
144
|
|
|
122
145
|
columns = ["Date", "aa", "bb", "cc", "bid", "ask", "dd", "ee"]
|
|
123
|
-
df = pd.read_csv(
|
|
146
|
+
df = pd.read_csv(
|
|
147
|
+
StringIO(res.text), delimiter=";", header=None, names=columns, dtype=str
|
|
148
|
+
)
|
|
124
149
|
df = df.assign(
|
|
125
150
|
Date=lambda x: pd.to_datetime(x["Date"], format="%d%m%Y"),
|
|
126
151
|
bid=lambda x: x["bid"].str.replace(",", ".").astype(np.float64),
|
|
@@ -135,7 +160,11 @@ def _get_symbol(symbol: str, start_date: DateInput, end_date: DateInput) -> pd.D
|
|
|
135
160
|
|
|
136
161
|
|
|
137
162
|
def get(
|
|
138
|
-
symbols: Union[str, List[str]],
|
|
163
|
+
symbols: Union[str, List[str]],
|
|
164
|
+
start: DateInput,
|
|
165
|
+
end: DateInput,
|
|
166
|
+
side: str = "ask",
|
|
167
|
+
groupby: str = "symbol",
|
|
139
168
|
) -> pd.DataFrame:
|
|
140
169
|
"""
|
|
141
170
|
Retorna um DataFrame pandas com séries temporais com taxas de câmbio.
|
|
@@ -163,6 +192,13 @@ def get(
|
|
|
163
192
|
Returns
|
|
164
193
|
-------
|
|
165
194
|
|
|
195
|
+
Notes
|
|
196
|
+
-----
|
|
197
|
+
The currency ID list and the master currency table are cached in memory
|
|
198
|
+
for the lifetime of the Python session so that multiple calls to
|
|
199
|
+
:func:`get` do not repeat the same HTTP requests. Use
|
|
200
|
+
:func:`clear_cache` to invalidate the cache when fresh data is needed.
|
|
201
|
+
|
|
166
202
|
DataFrame :
|
|
167
203
|
Série temporal com cotações diárias das moedas solicitadas.
|
|
168
204
|
"""
|
|
@@ -184,6 +220,6 @@ def get(
|
|
|
184
220
|
elif groupby == "side":
|
|
185
221
|
return df.reorder_levels([1, 0], axis=1).sort_index(axis=1)
|
|
186
222
|
else:
|
|
187
|
-
raise
|
|
223
|
+
raise ValueError("Unknown side value, use: bid, ask, both")
|
|
188
224
|
else:
|
|
189
|
-
raise
|
|
225
|
+
raise CurrencyNotFoundError(f"Currency not found: {symbols}")
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
class BCBError(Exception):
|
|
2
|
+
"""Base exception for all python-bcb errors."""
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class BCBAPIError(BCBError):
|
|
6
|
+
"""HTTP or API-level error from BCB."""
|
|
7
|
+
|
|
8
|
+
def __init__(self, message: str, status_code: int | None = None):
|
|
9
|
+
super().__init__(message)
|
|
10
|
+
self.status_code = status_code
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CurrencyNotFoundError(BCBError):
|
|
14
|
+
"""Raised when a requested currency symbol is not found."""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SGSError(BCBError):
|
|
18
|
+
"""Raised for SGS-specific API errors."""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ODataError(BCBError):
|
|
22
|
+
"""Raised for OData query/metadata errors."""
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
1
2
|
from .framework import (
|
|
2
3
|
ODataEntitySet,
|
|
3
4
|
ODataFunctionImport,
|
|
@@ -13,10 +14,10 @@ OLINDA_BASE_URL = "https://olinda.bcb.gov.br/olinda/servico"
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class EndpointMeta(type):
|
|
16
|
-
def __init__(self, *args, **kwargs):
|
|
17
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
17
18
|
super().__init__(*args, **kwargs)
|
|
18
19
|
|
|
19
|
-
def __call__(self, *args):
|
|
20
|
+
def __call__(self, *args: Any) -> Any:
|
|
20
21
|
obj = super().__call__(*args)
|
|
21
22
|
entity = args[0]
|
|
22
23
|
if isinstance(entity, ODataEntitySet):
|
|
@@ -29,10 +30,10 @@ class EndpointMeta(type):
|
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
class EndpointQuery(ODataQuery):
|
|
32
|
-
_DATE_COLUMN_NAMES_BY_ENDPOINT = {
|
|
33
|
+
_DATE_COLUMN_NAMES_BY_ENDPOINT: dict[str, dict[str, str]] = {
|
|
33
34
|
"IfDataCadastro": {"Data": "%Y%m"}
|
|
34
35
|
}
|
|
35
|
-
_DATE_COLUMN_NAMES = {
|
|
36
|
+
_DATE_COLUMN_NAMES: set[str] = {
|
|
36
37
|
"Data",
|
|
37
38
|
"dataHoraCotacao",
|
|
38
39
|
"InicioPeriodo",
|
|
@@ -40,15 +41,36 @@ class EndpointQuery(ODataQuery):
|
|
|
40
41
|
"DataVigencia",
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
def
|
|
44
|
+
def __init__(
|
|
45
|
+
self,
|
|
46
|
+
entity: Any,
|
|
47
|
+
url: str,
|
|
48
|
+
date_columns: Optional[list[str]] = None,
|
|
49
|
+
) -> None:
|
|
50
|
+
super().__init__(entity, url)
|
|
51
|
+
self._date_columns: list[str] = date_columns or []
|
|
52
|
+
|
|
53
|
+
def collect(self) -> pd.DataFrame:
|
|
44
54
|
raw_data = super().collect()
|
|
45
55
|
data = pd.DataFrame(raw_data["value"])
|
|
46
56
|
if not self._raw:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
if self._date_columns:
|
|
58
|
+
# Use the explicit list provided by the API subclass.
|
|
59
|
+
for col in self._date_columns:
|
|
60
|
+
if col in data.columns:
|
|
61
|
+
data[col] = pd.to_datetime(data[col])
|
|
62
|
+
else:
|
|
63
|
+
# Fall back to the built-in heuristic.
|
|
64
|
+
endpoint_overrides = self._DATE_COLUMN_NAMES_BY_ENDPOINT.get(
|
|
65
|
+
self.entity.name, {}
|
|
66
|
+
)
|
|
67
|
+
for col in self._DATE_COLUMN_NAMES:
|
|
68
|
+
if col in endpoint_overrides:
|
|
69
|
+
data[col] = pd.to_datetime(
|
|
70
|
+
data[col], format=endpoint_overrides[col]
|
|
71
|
+
)
|
|
72
|
+
elif col in data.columns:
|
|
73
|
+
data[col] = pd.to_datetime(data[col])
|
|
52
74
|
return data
|
|
53
75
|
|
|
54
76
|
|
|
@@ -65,7 +87,10 @@ class Endpoint(metaclass=EndpointMeta):
|
|
|
65
87
|
:py:meth:`bcb.odata.api.BaseODataAPI.get_endpoint` das classes que herdam
|
|
66
88
|
:py:class:`bcb.odata.api.BaseODataAPI`.
|
|
67
89
|
"""
|
|
68
|
-
|
|
90
|
+
|
|
91
|
+
def __init__(
|
|
92
|
+
self, entity: Any, url: str, date_columns: Optional[list[str]] = None
|
|
93
|
+
) -> None:
|
|
69
94
|
"""
|
|
70
95
|
Construtor da classe Endpoint.
|
|
71
96
|
|
|
@@ -76,11 +101,15 @@ class Endpoint(metaclass=EndpointMeta):
|
|
|
76
101
|
Obtidos da classe ``bcb.odata.framework.ODataService``.
|
|
77
102
|
url : str
|
|
78
103
|
URL da API OData.
|
|
104
|
+
date_columns : list[str], optional
|
|
105
|
+
Colunas a converter para datetime. Quando fornecido, substitui a
|
|
106
|
+
heurística padrão de detecção de datas.
|
|
79
107
|
"""
|
|
80
108
|
self._entity = entity
|
|
81
109
|
self._url = url
|
|
110
|
+
self._date_columns: list[str] = date_columns or []
|
|
82
111
|
|
|
83
|
-
def get(self, *args, **kwargs):
|
|
112
|
+
def get(self, *args: Any, **kwargs: Any) -> pd.DataFrame:
|
|
84
113
|
"""
|
|
85
114
|
Executa a consulta na API OData e retorna o resultado.
|
|
86
115
|
|
|
@@ -94,7 +123,7 @@ class Endpoint(metaclass=EndpointMeta):
|
|
|
94
123
|
-------
|
|
95
124
|
pd.DataFrame: resultado da consulta
|
|
96
125
|
"""
|
|
97
|
-
_query = EndpointQuery(self._entity, self._url)
|
|
126
|
+
_query = EndpointQuery(self._entity, self._url, self._date_columns)
|
|
98
127
|
for arg in args:
|
|
99
128
|
if isinstance(arg, ODataPropertyFilter):
|
|
100
129
|
_query.filter(arg)
|
|
@@ -120,7 +149,7 @@ class Endpoint(metaclass=EndpointMeta):
|
|
|
120
149
|
_query.reset()
|
|
121
150
|
return data
|
|
122
151
|
|
|
123
|
-
def query(self):
|
|
152
|
+
def query(self) -> EndpointQuery:
|
|
124
153
|
"""
|
|
125
154
|
Retorna uma instância de EndpointQuery através da qual se construirá a consulta na API OData.
|
|
126
155
|
|
|
@@ -128,7 +157,7 @@ class Endpoint(metaclass=EndpointMeta):
|
|
|
128
157
|
-------
|
|
129
158
|
bcb.odata.api.EndpointQuery
|
|
130
159
|
"""
|
|
131
|
-
return EndpointQuery(self._entity, self._url)
|
|
160
|
+
return EndpointQuery(self._entity, self._url, self._date_columns)
|
|
132
161
|
|
|
133
162
|
|
|
134
163
|
class BaseODataAPI:
|
|
@@ -138,13 +167,16 @@ class BaseODataAPI:
|
|
|
138
167
|
Essa classe não deve ser acessada diretamente.
|
|
139
168
|
"""
|
|
140
169
|
|
|
141
|
-
|
|
170
|
+
BASE_URL: str
|
|
171
|
+
DATE_COLUMNS: list[str] = []
|
|
172
|
+
|
|
173
|
+
def __init__(self) -> None:
|
|
142
174
|
"""
|
|
143
175
|
BaseODataAPI construtor
|
|
144
176
|
"""
|
|
145
177
|
self.service = ODataService(self.BASE_URL)
|
|
146
178
|
|
|
147
|
-
def describe(self, endpoint=None):
|
|
179
|
+
def describe(self, endpoint: Optional[str] = None) -> None:
|
|
148
180
|
"""
|
|
149
181
|
Mostra a descrição de uma API ou de um *endpoint*
|
|
150
182
|
específico.
|
|
@@ -166,7 +198,7 @@ class BaseODataAPI:
|
|
|
166
198
|
else:
|
|
167
199
|
self.service.describe()
|
|
168
200
|
|
|
169
|
-
def get_endpoint(self, endpoint):
|
|
201
|
+
def get_endpoint(self, endpoint: str) -> Endpoint:
|
|
170
202
|
"""
|
|
171
203
|
Obtem o *endpoint*
|
|
172
204
|
|
|
@@ -186,7 +218,9 @@ class BaseODataAPI:
|
|
|
186
218
|
ValueError
|
|
187
219
|
Se o *endpoint* fornecido é errado.
|
|
188
220
|
"""
|
|
189
|
-
return Endpoint(
|
|
221
|
+
return Endpoint(
|
|
222
|
+
self.service[endpoint], self.service.url, self.DATE_COLUMNS or None
|
|
223
|
+
)
|
|
190
224
|
|
|
191
225
|
|
|
192
226
|
class ODataAPI(BaseODataAPI):
|
|
@@ -200,7 +234,7 @@ class ODataAPI(BaseODataAPI):
|
|
|
200
234
|
não possuem implementação específica.
|
|
201
235
|
"""
|
|
202
236
|
|
|
203
|
-
def __init__(self, url):
|
|
237
|
+
def __init__(self, url: str) -> None:
|
|
204
238
|
"""
|
|
205
239
|
Parameters
|
|
206
240
|
----------
|
|
@@ -411,8 +445,8 @@ class TarifasBancariasPorInstituicaoFinanceira(BaseODataAPI):
|
|
|
411
445
|
cobradas por instituições financeiras, por Segmento e por Instituição.
|
|
412
446
|
"""
|
|
413
447
|
|
|
414
|
-
|
|
415
|
-
BASE_URL = f"{OLINDA_BASE_URL}/{
|
|
448
|
+
SERVICE_KEY = "Informes_ListaTarifasPorInstituicaoFinanceira"
|
|
449
|
+
BASE_URL = f"{OLINDA_BASE_URL}/{SERVICE_KEY}/versao/v1/odata/"
|
|
416
450
|
|
|
417
451
|
|
|
418
452
|
class TarifasBancariasPorServico(BaseODataAPI):
|
|
@@ -424,8 +458,8 @@ class TarifasBancariasPorServico(BaseODataAPI):
|
|
|
424
458
|
por serviço.
|
|
425
459
|
"""
|
|
426
460
|
|
|
427
|
-
|
|
428
|
-
BASE_URL = f"{OLINDA_BASE_URL}/{
|
|
461
|
+
SERVICE_KEY = "Informes_ListaValoresDeServicoBancario"
|
|
462
|
+
BASE_URL = f"{OLINDA_BASE_URL}/{SERVICE_KEY}/versao/v1/odata/"
|
|
429
463
|
|
|
430
464
|
|
|
431
465
|
class PostosAtendimentoEletronicoPorInstituicaoFinanceira(BaseODataAPI):
|
|
@@ -437,8 +471,8 @@ class PostosAtendimentoEletronicoPorInstituicaoFinanceira(BaseODataAPI):
|
|
|
437
471
|
pelo Banco Central.
|
|
438
472
|
"""
|
|
439
473
|
|
|
440
|
-
|
|
441
|
-
BASE_URL = f"{OLINDA_BASE_URL}/{
|
|
474
|
+
SERVICE_KEY = "Informes_PostosDeAtendimentoEletronico"
|
|
475
|
+
BASE_URL = f"{OLINDA_BASE_URL}/{SERVICE_KEY}/versao/v1/odata/"
|
|
442
476
|
|
|
443
477
|
|
|
444
478
|
class PostosAtendimentoCorrespondentesPorInstituicaoFinanceira(BaseODataAPI):
|
|
@@ -451,8 +485,8 @@ class PostosAtendimentoCorrespondentesPorInstituicaoFinanceira(BaseODataAPI):
|
|
|
451
485
|
descrito na Resolução 3.954.
|
|
452
486
|
"""
|
|
453
487
|
|
|
454
|
-
|
|
455
|
-
BASE_URL = f"{OLINDA_BASE_URL}/{
|
|
488
|
+
SERVICE_KEY = "Informes_Correspondentes"
|
|
489
|
+
BASE_URL = f"{OLINDA_BASE_URL}/{SERVICE_KEY}/versao/v1/odata/"
|
|
456
490
|
|
|
457
491
|
|
|
458
492
|
class EstatisticasSTR(BaseODataAPI):
|
|
@@ -464,8 +498,8 @@ class EstatisticasSTR(BaseODataAPI):
|
|
|
464
498
|
mantidas pelos participantes no Banco Central.
|
|
465
499
|
"""
|
|
466
500
|
|
|
467
|
-
|
|
468
|
-
BASE_URL = f"{OLINDA_BASE_URL}/{
|
|
501
|
+
SERVICE_KEY = "STR"
|
|
502
|
+
BASE_URL = f"{OLINDA_BASE_URL}/{SERVICE_KEY}/versao/v1/odata/"
|
|
469
503
|
|
|
470
504
|
|
|
471
505
|
class DinheiroCirculacao(BaseODataAPI):
|
|
@@ -478,8 +512,8 @@ class DinheiroCirculacao(BaseODataAPI):
|
|
|
478
512
|
Real (símbolos : R$, BRL).
|
|
479
513
|
"""
|
|
480
514
|
|
|
481
|
-
|
|
482
|
-
BASE_URL = f"{OLINDA_BASE_URL}/{
|
|
515
|
+
SERVICE_KEY = "mecir_dinheiro_em_circulacao"
|
|
516
|
+
BASE_URL = f"{OLINDA_BASE_URL}/{SERVICE_KEY}/versao/v1/odata/"
|
|
483
517
|
|
|
484
518
|
|
|
485
519
|
# /Informes_Ouvidorias/versao/v1/odata/
|