curl --request POST \
--url https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/treasury_direct \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_title": null,
"p_maturity": null,
"p_from": null,
"p_to": null
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/treasury_direct"
payload = {
"p_title": None,
"p_maturity": None,
"p_from": None,
"p_to": 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_title: null, p_maturity: null, p_from: null, p_to: null})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/treasury_direct', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"base_date": "2023-12-25",
"title": "<string>",
"maturity": "2023-12-25",
"buy_rate_pct": 123,
"sell_rate_pct": 123,
"buy_pu": 123,
"sell_pu": 123,
"base_pu": 123,
"source": "<string>",
"licence": "<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>"
}treasury_direct
Tesouro Direto posted rates and prices per title (Tesouro Nacional open data, ODbL 1.0: credit Tesouro Nacional; every row carries source and licence). Newest base date first, then title and maturity. With no argument: every title on the newest base date held, which is the sovereign curve the retail platform posts. p_title is a title type as published (Tesouro Selic, Tesouro Prefixado, Tesouro IPCA+, Tesouro IPCA+ com Juros Semestrais, …; case is ignored; an unknown type raises 22023 with the list); p_maturity one maturity; p_from..p_to a window of base dates (p_from alone: from p_from to the newest). NOTHING IS DERIVED: buy_rate_pct and sell_rate_pct are the morning quotes in % a year as published, and can be negative; buy_pu and sell_pu settle the next business day, base_pu is the same-day mark. These are QUOTES, NOT TRADES. A NULL price is a side the title was not on sale on. Refuses above 1000 rows (22023): about 60 titles a day, so narrow the window or name a title.
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/treasury_direct \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_title": null,
"p_maturity": null,
"p_from": null,
"p_to": null
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/treasury_direct"
payload = {
"p_title": None,
"p_maturity": None,
"p_from": None,
"p_to": 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_title: null, p_maturity: null, p_from: null, p_to: null})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/treasury_direct', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"base_date": "2023-12-25",
"title": "<string>",
"maturity": "2023-12-25",
"buy_rate_pct": 123,
"sell_rate_pct": 123,
"buy_pu": 123,
"sell_pu": 123,
"base_pu": 123,
"source": "<string>",
"licence": "<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?