Allocation policy
Propose new policy
Draft: specification in progress. Endpoints and fields may change.
Records a new version of the policy defined by the company, with proportions
and rebalancing rules. The percentages must add up to 100 and only supported
assets are accepted. The new version applies to future deposits and its rules
start generating transactions for approval. TESA does not recommend
allocations. Scope: admin.
PUT
/
politica-de-alocacao
Propose new policy
curl --request PUT \
--url https://api.t3sa.com/v1/politica-de-alocacao \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alocacao": [
{
"percentual": 60
}
],
"regras": [
{
"limite": 123,
"id": "rgr_1",
"ativa": true
}
],
"comentario": "<string>"
}
'import requests
url = "https://api.t3sa.com/v1/politica-de-alocacao"
payload = {
"alocacao": [{ "percentual": 60 }],
"regras": [
{
"limite": 123,
"id": "rgr_1",
"ativa": True
}
],
"comentario": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
alocacao: [{percentual: 60}],
regras: [{limite: 123, id: 'rgr_1', ativa: true}],
comentario: '<string>'
})
};
fetch('https://api.t3sa.com/v1/politica-de-alocacao', 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://api.t3sa.com/v1/politica-de-alocacao",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'alocacao' => [
[
'percentual' => 60
]
],
'regras' => [
[
'limite' => 123,
'id' => 'rgr_1',
'ativa' => true
]
],
'comentario' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.t3sa.com/v1/politica-de-alocacao"
payload := strings.NewReader("{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"regras\": [\n {\n \"limite\": 123,\n \"id\": \"rgr_1\",\n \"ativa\": true\n }\n ],\n \"comentario\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.t3sa.com/v1/politica-de-alocacao")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"regras\": [\n {\n \"limite\": 123,\n \"id\": \"rgr_1\",\n \"ativa\": true\n }\n ],\n \"comentario\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.t3sa.com/v1/politica-de-alocacao")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"regras\": [\n {\n \"limite\": 123,\n \"id\": \"rgr_1\",\n \"ativa\": true\n }\n ],\n \"comentario\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"versao": 3,
"alocacao": [
{
"ativo": "USDY",
"percentual": 60
}
],
"regras": [
{
"gatilho": "spread_acima",
"limite": 123,
"id": "rgr_1",
"ativa": true
}
],
"status": "vigente",
"aprovada_por": "<string>",
"vigente_desde": "2023-11-07T05:31:56Z"
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}Draft: specification in progress. Endpoints and fields may change.
Authorizations
bearerAuthbearerAuth & tesaTimestamp & tesaSignature
Body
application/json
Response
New version registered.
⌘I
Propose new policy
curl --request PUT \
--url https://api.t3sa.com/v1/politica-de-alocacao \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alocacao": [
{
"percentual": 60
}
],
"regras": [
{
"limite": 123,
"id": "rgr_1",
"ativa": true
}
],
"comentario": "<string>"
}
'import requests
url = "https://api.t3sa.com/v1/politica-de-alocacao"
payload = {
"alocacao": [{ "percentual": 60 }],
"regras": [
{
"limite": 123,
"id": "rgr_1",
"ativa": True
}
],
"comentario": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
alocacao: [{percentual: 60}],
regras: [{limite: 123, id: 'rgr_1', ativa: true}],
comentario: '<string>'
})
};
fetch('https://api.t3sa.com/v1/politica-de-alocacao', 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://api.t3sa.com/v1/politica-de-alocacao",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'alocacao' => [
[
'percentual' => 60
]
],
'regras' => [
[
'limite' => 123,
'id' => 'rgr_1',
'ativa' => true
]
],
'comentario' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.t3sa.com/v1/politica-de-alocacao"
payload := strings.NewReader("{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"regras\": [\n {\n \"limite\": 123,\n \"id\": \"rgr_1\",\n \"ativa\": true\n }\n ],\n \"comentario\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://api.t3sa.com/v1/politica-de-alocacao")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"regras\": [\n {\n \"limite\": 123,\n \"id\": \"rgr_1\",\n \"ativa\": true\n }\n ],\n \"comentario\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.t3sa.com/v1/politica-de-alocacao")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alocacao\": [\n {\n \"percentual\": 60\n }\n ],\n \"regras\": [\n {\n \"limite\": 123,\n \"id\": \"rgr_1\",\n \"ativa\": true\n }\n ],\n \"comentario\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"versao": 3,
"alocacao": [
{
"ativo": "USDY",
"percentual": 60
}
],
"regras": [
{
"gatilho": "spread_acima",
"limite": 123,
"id": "rgr_1",
"ativa": true
}
],
"status": "vigente",
"aprovada_por": "<string>",
"vigente_desde": "2023-11-07T05:31:56Z"
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}{
"erro": {
"codigo": "saldo_insuficiente",
"mensagem": "<string>",
"campo": "<string>",
"requisicao_id": "req_9d8c7b"
}
}