Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.3.0"
".": "1.4.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ client = Brapi(
quote = client.quote.retrieve(
tickers="REPLACE_ME",
)
print(quote.requested_at)
print(quote.guidance)
```

## Async usage
Expand All @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/brapi/_version.py
Original file line number Diff line number Diff line change
@@ -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
24 changes: 22 additions & 2 deletions src/brapi/resources/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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`.
Expand All @@ -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&sector=Logística&limit=20"
```
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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`.
Expand All @@ -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&sector=Logística&limit=20"
```
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down
26 changes: 24 additions & 2 deletions src/brapi/types/financial_data_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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"""
Expand Down
9 changes: 9 additions & 0 deletions src/brapi/types/quote_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
8 changes: 8 additions & 0 deletions src/brapi/types/quote_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand All @@ -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]
Expand Down
22 changes: 22 additions & 0 deletions src/brapi/types/quote_retrieve_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"ResultDividendsDataStockDividend",
"ResultHistoricalDataPrice",
"ResultSummaryProfile",
"Guidance",
"GuidanceDetails",
]


Expand Down Expand Up @@ -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"""
Expand All @@ -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.
"""
2 changes: 2 additions & 0 deletions tests/api_resources/test_quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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"])
Expand Down