curl --request POST \
--url https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_codes": [
"<string>"
],
"p_end_month": "2023-12-25",
"p_series": null,
"p_classes": null
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns"
payload = {
"p_codes": ["<string>"],
"p_end_month": "2023-12-25",
"p_series": None,
"p_classes": 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_codes: ['<string>'],
p_end_month: '2023-12-25',
p_series: null,
p_classes: null
})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"line_no": 123,
"input_code": "<string>",
"code": "<string>",
"numero_serie": 123,
"classe": "<string>",
"month": "2023-12-25",
"data_referencia": "2023-12-25",
"versao": 123,
"quantidade_certificados": 123,
"valor_certificados": 123,
"rendimentos": 123,
"amortizacoes": 123,
"pu": 123,
"paid_per_unit": 123,
"factor": 123,
"month_flag": "<string>",
"taxa_juros": "<string>",
"data_vencimento": "2023-12-25",
"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_credit_returns
The value ON THE CURVE of a CRA or CRI as its securitizer files it (catalog v71, #766): for each CETIP code (trimmed, upper-cased, a leading CRA- or CRI- stripped), the 13 month-ends p_end_month - 12 .. p_end_month from cvm_securit_serie, one row per (line, month), oldest first. The series is the one p_series / p_classes name (from portfolio_instruments) or the code’s only series in the window; two or more with none named is serie_ambigua. A month’s row is its informe (data_referencia = the month, the month-end value) at the highest versao. pu = valor_certificados / quantidade_certificados; paid_per_unit = (rendimentos + amortizacoes) / quantidade, NULL read as 0; factor = (pu + paid) / previous pu, 12 places, NULL on the first month or a flagged one: compound the 12 factors for the 12-month return. month_flag says why a month is unknown: serie_ambigua, mes_ausente, valor_invalido, quantidade_mudou, pu_repetido (the value of the month before carried over), queda_sem_evento_arquivado (the pu falls and nothing paid is filed: an unfiled coupon or amortization, never read as a loss), pagamento_acima_do_pu, pagamento_incompativel (a payment month whose return is outside 0.5 .. 1.5 times the median of the line’s months with no payment, or with fewer than 3 of them). A window with any flag has no return. rentabilidade is never read. It is the securitizer’s value on the curve, not a market price. At most 70 codes (13 rows each); 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_credit_returns \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_codes": [
"<string>"
],
"p_end_month": "2023-12-25",
"p_series": null,
"p_classes": null
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns"
payload = {
"p_codes": ["<string>"],
"p_end_month": "2023-12-25",
"p_series": None,
"p_classes": 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_codes: ['<string>'],
p_end_month: '2023-12-25',
p_series: null,
p_classes: null
})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/portfolio_credit_returns', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"line_no": 123,
"input_code": "<string>",
"code": "<string>",
"numero_serie": 123,
"classe": "<string>",
"month": "2023-12-25",
"data_referencia": "2023-12-25",
"versao": 123,
"quantidade_certificados": 123,
"valor_certificados": 123,
"rendimentos": 123,
"amortizacoes": 123,
"pu": 123,
"paid_per_unit": 123,
"factor": 123,
"month_flag": "<string>",
"taxa_juros": "<string>",
"data_vencimento": "2023-12-25",
"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?