curl --request POST \
--url https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_classe_anbima": "<string>",
"p_month": null
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution"
payload = {
"p_classe_anbima": "<string>",
"p_month": None
}
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_classe_anbima: '<string>', p_month: null})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'p_classe_anbima' => '<string>',
'p_month' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution"
payload := strings.NewReader("{\n \"p_classe_anbima\": \"<string>\",\n \"p_month\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"p_classe_anbima\": \"<string>\",\n \"p_month\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"p_classe_anbima\": \"<string>\",\n \"p_month\": null\n}"
response = http.request(request)
puts response.read_body[
{
"classe_anbima": "<string>",
"fundo_cotas": "<string>",
"window_months": 123,
"start_month": "2023-12-25",
"end_month": "2023-12-25",
"month_complete": true,
"n_universe": 123,
"n_funds": 123,
"n_excluded_no_quota": 123,
"n_excluded_subclass": 123,
"p25_pct": 123,
"median_pct": 123,
"p75_pct": 123,
"min_funds": 123,
"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>"
}class_return_distribution
The NET quota return distribution of one ANBIMA class (catalog v66, #609): what an equivalent ETF’s return is set against. Two rows, window_months 12 and 6, ending at the close of end_month (p_month, any day of the month; NULL = the last complete FI month, latest_complete_period(‘fi’)). Funds: FI funds whose newest CVM Extrato files exactly p_classe_anbima (outer spaces trimmed, never a wider class) and FUNDO_COTAS p_fundo_cotas (S or N), and that are active as in portfolio_fee_peers (a quota in fact_fund_monthly in the three reference months ending in end_month): n_universe. Return = (closing quota of end_month / closing quota of start_month - 1) x 100, from fact_fund_monthly’s one stable quota subclass, the quota api.fund_nav serves; the Informe Diario quota is net of the fees the class accrues (research #610), so this is a net return. Excluded and counted: n_excluded_no_quota (no positive quota at either end) and n_excluded_subclass (the quota subclass changed between the ends). p25_pct, median_pct and p75_pct are plain percentiles over the n_funds returns, not winsorized. Fewer than min_funds (30) funds with a return, or an incomplete end_month (mv_period_completeness): status nao_avaliado, NULL statistics and a Portuguese reason, never a fallback. ETFs are not in the universe (SILO keeps them out of fact_fund_monthly). A statistic of a class, not a forecast or a recommendation. p_classe_anbima NULL or blank, or p_fundo_cotas other than S or N, RAISES 22023; the result is two rows, one page.
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/class_return_distribution \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_classe_anbima": "<string>",
"p_month": null
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution"
payload = {
"p_classe_anbima": "<string>",
"p_month": None
}
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_classe_anbima: '<string>', p_month: null})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'p_classe_anbima' => '<string>',
'p_month' => null
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution"
payload := strings.NewReader("{\n \"p_classe_anbima\": \"<string>\",\n \"p_month\": null\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"p_classe_anbima\": \"<string>\",\n \"p_month\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/class_return_distribution")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"p_classe_anbima\": \"<string>\",\n \"p_month\": null\n}"
response = http.request(request)
puts response.read_body[
{
"classe_anbima": "<string>",
"fundo_cotas": "<string>",
"window_months": 123,
"start_month": "2023-12-25",
"end_month": "2023-12-25",
"month_complete": true,
"n_universe": 123,
"n_funds": 123,
"n_excluded_no_quota": 123,
"n_excluded_subclass": 123,
"p25_pct": 123,
"median_pct": 123,
"p75_pct": 123,
"min_funds": 123,
"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
The publishable key (sb_publishable_…), on every request. It is NOT a JWT — sending it as Authorization: Bearer is rejected as an invalid JWT. It identifies the project, not you, and maps to the Postgres anon role.
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?