curl --request POST \
--url https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_equivalents \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_classes": [
"<string>"
],
"p_as_of": "2023-12-25"
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_equivalents"
payload = {
"p_classes": ["<string>"],
"p_as_of": "2023-12-25"
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({p_classes: ['<string>'], p_as_of: '2023-12-25'})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_equivalents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"classe_anbima": "<string>",
"class_indices": [
"<string>"
],
"n_etfs": 123,
"ticker": "<string>",
"etf_cnpj": "<string>",
"etf_name": "<string>",
"underlying_index": "<string>",
"segment": "<string>",
"pl_brl": 123,
"pl_as_of": "2023-12-25",
"fee_pct_year": 123,
"fee_as_of": "2023-12-25",
"snapshot_source": "<string>",
"pl_rank": 123,
"is_equivalent": true,
"status": "<string>",
"reason": "<string>"
}
]{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}portfolio_equivalents
The market equivalent of an ANBIMA class (catalog v68, #609): the active ETFs that track an index the owner-reviewed list (src/portfolio/rules/equivalents/class_index.yaml, generated into public.portfolio_class_index; only pairs with status aprovada) maps to the class, read in reverse (class -> index). One row per (class, ETF CNPJ) among cvm_etf_registry.is_active ETFs, the universe portfolio_fee_peers uses; class_indices lists every mapped index and n_etfs counts the ETFs. pl_brl and fee_pct_year are the third-party values etfsbrasil.com.br prints (etf_market_snapshot.nav and taxa_adm_pct, each the newest snapshot that has one dated no later than p_as_of, dated pl_as_of and fee_as_of), the values portfolio_fees serves as etf_site_pl and etf_site_taxa_adm: never a CVM filing, never rescaled. is_equivalent marks the largest by PL across all the class’s indices (pl_rank 1, ties by ticker); an ETF with no PL is never ranked. segment is the registry’s as filed: fixed_income_br trades in B3’s FORWARD segment (prices in trade_consolidated_history), the others on the cash tape (quote_history). A class with no approved pair (status sem_par) or with no active ETF on its indices (sem_etf) comes back as one row with NULL ETF columns; when no ETF has a PL every row is sem_pl and none is the equivalent. The index is never inferred from a fund’s name. reason is Portuguese. It names an ETF with the same objective, not a recommendation. 1 to 50 non-blank classes (outer spaces trimmed, duplicates collapsed); otherwise RAISES 22023; one page, never trimmed.
Row cap. A window producing more than 1000 rows raises SQLSTATE 22023 naming this function. Nothing is trimmed to fit — PostgREST would silently cut the response at 1000 and a cut-short series is indistinguishable from one that simply ends. This function does not page — narrow the window instead.
curl --request POST \
--url https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_equivalents \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_classes": [
"<string>"
],
"p_as_of": "2023-12-25"
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_equivalents"
payload = {
"p_classes": ["<string>"],
"p_as_of": "2023-12-25"
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({p_classes: ['<string>'], p_as_of: '2023-12-25'})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_equivalents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"classe_anbima": "<string>",
"class_indices": [
"<string>"
],
"n_etfs": 123,
"ticker": "<string>",
"etf_cnpj": "<string>",
"etf_name": "<string>",
"underlying_index": "<string>",
"segment": "<string>",
"pl_brl": 123,
"pl_as_of": "2023-12-25",
"fee_pct_year": 123,
"fee_as_of": "2023-12-25",
"snapshot_source": "<string>",
"pl_rank": 123,
"is_equivalent": true,
"status": "<string>",
"reason": "<string>"
}
]{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}Authorizations
Body
Response
The result set, oldest first. An unknown id is an empty array, not a 404 and never a guessed value.
Was this page helpful?