diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2a8f4ff..3e9af1b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.3.0" + ".": "1.4.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 3f5cf30..f0fb1ee 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 11 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/alisson/brapi-de3d30399876b2fbeef7ab49e0795a0284ce30db2429b708645f4f38c7c4340c.yml -openapi_spec_hash: 36b4e6d8aab0be7695d66d369b3cee94 -config_hash: 6f10a67950f65bf850612b59838ad03b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/alisson/brapi-87253b604a0ce6bd955a5229442bf8dbdad30e60f5c61d07ebe2904fde2db95d.yml +openapi_spec_hash: c49292ef0416342cb4326f5b8bb1317f +config_hash: 14da4c1963f3e0764a3e82d626a1d762 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d6e659..3c0cbbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.4.0 (2026-05-28) + +Full Changelog: [v1.3.0...v1.4.0](https://github.com/brapi-dev/brapi-python/compare/v1.3.0...v1.4.0) + +### Features + +* **api:** api update ([d293ad8](https://github.com/brapi-dev/brapi-python/commit/d293ad8b00f5d1e51c1dfa92fd4c41d56660b90a)) +* **api:** api update ([7fcaaff](https://github.com/brapi-dev/brapi-python/commit/7fcaaff76a52c2a337f63ffe20c68cde5d2ee661)) + ## 1.3.0 (2026-05-14) Full Changelog: [v1.2.0...v1.3.0](https://github.com/brapi-dev/brapi-python/compare/v1.2.0...v1.3.0) diff --git a/README.md b/README.md index 8a38d09..4b16845 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ client = Brapi( quote = client.quote.retrieve( tickers="REPLACE_ME", ) -print(quote.requested_at) +print(quote.guidance) ``` ## Async usage @@ -58,7 +58,7 @@ async def main() -> None: quote = await client.quote.retrieve( tickers="REPLACE_ME", ) - print(quote.requested_at) + print(quote.guidance) asyncio.run(main()) @@ -93,7 +93,7 @@ async def main() -> None: quote = await client.quote.retrieve( tickers="REPLACE_ME", ) - print(quote.requested_at) + print(quote.guidance) asyncio.run(main()) @@ -250,7 +250,7 @@ response = client.quote.with_raw_response.retrieve( print(response.headers.get('X-My-Header')) quote = response.parse() # get the object that `quote.retrieve()` would have returned -print(quote.requested_at) +print(quote.guidance) ``` These methods return an [`APIResponse`](https://github.com/brapi-dev/brapi-python/tree/main/src/brapi/_response.py) object. diff --git a/pyproject.toml b/pyproject.toml index f13a33e..a541da4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "brapi" -version = "1.3.0" +version = "1.4.0" description = "The official Python library for the brapi API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/brapi/_version.py b/src/brapi/_version.py index 4da6408..a328235 100644 --- a/src/brapi/_version.py +++ b/src/brapi/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "brapi" -__version__ = "1.3.0" # x-release-please-version +__version__ = "1.4.0" # x-release-please-version diff --git a/src/brapi/resources/quote.py b/src/brapi/resources/quote.py index 43174fa..b29f848 100644 --- a/src/brapi/resources/quote.py +++ b/src/brapi/resources/quote.py @@ -195,7 +195,7 @@ def retrieve( ### Fonte dos Dados: - B3 (Bolsa de Valores do Brasil), CVM (Comissão de Valores Mobiliários) + CVM (Comissão de Valores Mobiliários) **Plano Mínimo:** Gratuito (limitado a 1 ticker/requisição e módulos básicos) **Autenticação:** Necessária para produção (tickers de teste PETR4 e VALE3 @@ -261,6 +261,7 @@ def list( sector: str | Omit = omit, sort_by: Literal["name", "close", "change", "change_abs", "volume", "market_cap_basic"] | Omit = omit, sort_order: Literal["asc", "desc"] | Omit = omit, + sub_type: Literal["stock", "unit", "fii", "etf", "fi-infra", "fi-agro", "fip", "fidc", "bdr"] | Omit = omit, type: Literal["stock", "fund", "bdr"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -279,6 +280,8 @@ def list( - **Busca por Nome ou Ticker:** Encontre ativos digitando "Petrobras", "PETR4" ou qualquer termo. - **Filtros por Tipo:** Ações (stock), Fundos Imobiliários (fund), BDRs (bdr). + - **Filtros por Subtipo:** Units, FIIs, ETFs, FI-Infra, FI-Agro, FIPs, FIDCs e + BDRs via `subType`. - **Filtros por Setor:** Energia, Financeiro, Tecnologia, Saúde, etc. - **Ordenação Flexível:** Ordene por volume, preço, market cap ou nome. - **Paginação:** Controle o número de resultados com `limit` e `page`. @@ -300,6 +303,9 @@ def list( # Filtrar por tipo e ordenar por volume curl -H "Authorization: Bearer SEU_TOKEN" "https://brapi.dev/api/quote/list?type=stock&sortBy=volume&sortOrder=desc&limit=10" + # Filtrar por subtipo + curl -H "Authorization: Bearer SEU_TOKEN" "https://brapi.dev/api/quote/list?subType=fi-agro&limit=10" + # Listar apenas FIIs de um setor específico curl -H "Authorization: Bearer SEU_TOKEN" "https://brapi.dev/api/quote/list?type=fund§or=Logística&limit=20" ``` @@ -334,6 +340,9 @@ def list( sort_order: Ordem de classificação + sub_type: Filtrar por classificação aditiva: stock, unit, fii, etf, fi-infra, fi-agro, + fip, fidc ou bdr + type: Filtrar por tipo de ativo extra_headers: Send extra headers @@ -360,6 +369,7 @@ def list( "sector": sector, "sort_by": sort_by, "sort_order": sort_order, + "sub_type": sub_type, "type": type, }, quote_list_params.QuoteListParams, @@ -540,7 +550,7 @@ async def retrieve( ### Fonte dos Dados: - B3 (Bolsa de Valores do Brasil), CVM (Comissão de Valores Mobiliários) + CVM (Comissão de Valores Mobiliários) **Plano Mínimo:** Gratuito (limitado a 1 ticker/requisição e módulos básicos) **Autenticação:** Necessária para produção (tickers de teste PETR4 e VALE3 @@ -606,6 +616,7 @@ async def list( sector: str | Omit = omit, sort_by: Literal["name", "close", "change", "change_abs", "volume", "market_cap_basic"] | Omit = omit, sort_order: Literal["asc", "desc"] | Omit = omit, + sub_type: Literal["stock", "unit", "fii", "etf", "fi-infra", "fi-agro", "fip", "fidc", "bdr"] | Omit = omit, type: Literal["stock", "fund", "bdr"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -624,6 +635,8 @@ async def list( - **Busca por Nome ou Ticker:** Encontre ativos digitando "Petrobras", "PETR4" ou qualquer termo. - **Filtros por Tipo:** Ações (stock), Fundos Imobiliários (fund), BDRs (bdr). + - **Filtros por Subtipo:** Units, FIIs, ETFs, FI-Infra, FI-Agro, FIPs, FIDCs e + BDRs via `subType`. - **Filtros por Setor:** Energia, Financeiro, Tecnologia, Saúde, etc. - **Ordenação Flexível:** Ordene por volume, preço, market cap ou nome. - **Paginação:** Controle o número de resultados com `limit` e `page`. @@ -645,6 +658,9 @@ async def list( # Filtrar por tipo e ordenar por volume curl -H "Authorization: Bearer SEU_TOKEN" "https://brapi.dev/api/quote/list?type=stock&sortBy=volume&sortOrder=desc&limit=10" + # Filtrar por subtipo + curl -H "Authorization: Bearer SEU_TOKEN" "https://brapi.dev/api/quote/list?subType=fi-agro&limit=10" + # Listar apenas FIIs de um setor específico curl -H "Authorization: Bearer SEU_TOKEN" "https://brapi.dev/api/quote/list?type=fund§or=Logística&limit=20" ``` @@ -679,6 +695,9 @@ async def list( sort_order: Ordem de classificação + sub_type: Filtrar por classificação aditiva: stock, unit, fii, etf, fi-infra, fi-agro, + fip, fidc ou bdr + type: Filtrar por tipo de ativo extra_headers: Send extra headers @@ -705,6 +724,7 @@ async def list( "sector": sector, "sort_by": sort_by, "sort_order": sort_order, + "sub_type": sub_type, "type": type, }, quote_list_params.QuoteListParams, diff --git a/src/brapi/types/financial_data_entry.py b/src/brapi/types/financial_data_entry.py index 8f08457..5599712 100644 --- a/src/brapi/types/financial_data_entry.py +++ b/src/brapi/types/financial_data_entry.py @@ -22,7 +22,19 @@ class FinancialDataEntry(BaseModel): """Dívida/PL""" earnings_growth: Optional[float] = FieldInfo(alias="earningsGrowth", default=None) - """Crescimento do lucro""" + """ + Crescimento do lucro do controlador (TTM) — variação dos últimos 4 trimestres em + relação aos 4 trimestres imediatamente anteriores, usando Lucro Líquido + Atribuível aos Controladores. Para crescimento anual (DRE de exercício vs. + exercício anterior), use earningsGrowthAnnual. + """ + + earnings_growth_annual: Optional[float] = FieldInfo(alias="earningsGrowthAnnual", default=None) + """ + Crescimento anual do lucro do controlador — variação do Lucro Líquido Atribuível + aos Controladores do último exercício social completo em relação ao exercício + anterior. + """ ebitda: Optional[float] = None """EBITDA""" @@ -61,7 +73,17 @@ class FinancialDataEntry(BaseModel): """ROE""" revenue_growth: Optional[float] = FieldInfo(alias="revenueGrowth", default=None) - """Crescimento da receita""" + """ + Crescimento da receita (TTM) — variação da receita dos últimos 4 trimestres em + relação aos 4 trimestres imediatamente anteriores. Para crescimento anual (DRE + de exercício vs. exercício anterior), use revenueGrowthAnnual. + """ + + revenue_growth_annual: Optional[float] = FieldInfo(alias="revenueGrowthAnnual", default=None) + """ + Crescimento anual da receita — variação da Receita Líquida do último exercício + social completo em relação ao exercício anterior. + """ revenue_per_share: Optional[float] = FieldInfo(alias="revenuePerShare", default=None) """Receita por ação""" diff --git a/src/brapi/types/quote_list_params.py b/src/brapi/types/quote_list_params.py index 0775148..e8bc904 100644 --- a/src/brapi/types/quote_list_params.py +++ b/src/brapi/types/quote_list_params.py @@ -33,5 +33,14 @@ class QuoteListParams(TypedDict, total=False): sort_order: Annotated[Literal["asc", "desc"], PropertyInfo(alias="sortOrder")] """Ordem de classificação""" + sub_type: Annotated[ + Literal["stock", "unit", "fii", "etf", "fi-infra", "fi-agro", "fip", "fidc", "bdr"], + PropertyInfo(alias="subType"), + ] + """ + Filtrar por classificação aditiva: stock, unit, fii, etf, fi-infra, fi-agro, + fip, fidc ou bdr + """ + type: Literal["stock", "fund", "bdr"] """Filtrar por tipo de ativo""" diff --git a/src/brapi/types/quote_list_response.py b/src/brapi/types/quote_list_response.py index 37fef71..bd976e0 100644 --- a/src/brapi/types/quote_list_response.py +++ b/src/brapi/types/quote_list_response.py @@ -37,6 +37,12 @@ class Stock(BaseModel): stock: str """Ticker do ativo""" + sub_type: Optional[str] = FieldInfo(alias="subType", default=None) + """ + Classificação aditiva do ativo: stock, unit, fii, etf, fi-infra, fi-agro, fip, + fidc ou bdr + """ + type: Optional[str] = None """Tipo do ativo""" @@ -49,6 +55,8 @@ class QuoteListResponse(BaseModel): available_stock_types: List[str] = FieldInfo(alias="availableStockTypes") + available_sub_type_types: List[str] = FieldInfo(alias="availableSubTypeTypes") + indexes: List[Index] stocks: List[Stock] diff --git a/src/brapi/types/quote_retrieve_response.py b/src/brapi/types/quote_retrieve_response.py index cc2ad80..bc13bb6 100644 --- a/src/brapi/types/quote_retrieve_response.py +++ b/src/brapi/types/quote_retrieve_response.py @@ -17,6 +17,8 @@ "ResultDividendsDataStockDividend", "ResultHistoricalDataPrice", "ResultSummaryProfile", + "Guidance", + "GuidanceDetails", ] @@ -320,6 +322,20 @@ class Result(BaseModel): """Valores válidos para o parâmetro range""" +class GuidanceDetails(BaseModel): + reason: str + + suggested_endpoint: str = FieldInfo(alias="suggestedEndpoint") + + +class Guidance(BaseModel): + code: str + + details: GuidanceDetails + + message: str + + class QuoteRetrieveResponse(BaseModel): requested_at: datetime = FieldInfo(alias="requestedAt") """Data e hora da requisição em formato ISO 8601""" @@ -328,3 +344,9 @@ class QuoteRetrieveResponse(BaseModel): took: int """Tempo de processamento em milissegundos""" + + guidance: Optional[List[Guidance]] = None + """ + Dicas contextuais quando a requisição funciona mas existe um endpoint mais + adequado para o caso de uso. + """ diff --git a/tests/api_resources/test_quote.py b/tests/api_resources/test_quote.py index eced03c..aa77cbe 100644 --- a/tests/api_resources/test_quote.py +++ b/tests/api_resources/test_quote.py @@ -91,6 +91,7 @@ def test_method_list_with_all_params(self, client: Brapi) -> None: sector="sector", sort_by="name", sort_order="asc", + sub_type="stock", type="stock", ) assert_matches_type(QuoteListResponse, quote, path=["response"]) @@ -197,6 +198,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncBrapi) -> No sector="sector", sort_by="name", sort_order="asc", + sub_type="stock", type="stock", ) assert_matches_type(QuoteListResponse, quote, path=["response"])