Time Controls
Upsert account time control
Creates or updates time-window controls for a trading account owned by the authenticated principal’s organization. The caller must have Controls Premium and organization control edit access.
PUT
/
v1
/
controls
/
accounts
/
{account_id}
/
time
Upsert account time control
curl --request PUT \
--url https://api.anthid.com/v1/controls/accounts/{account_id}/time \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stale_order_millis": 123,
"trading_end": "<string>",
"trading_start": "<string>"
}
'import requests
url = "https://api.anthid.com/v1/controls/accounts/{account_id}/time"
payload = {
"stale_order_millis": 123,
"trading_end": "<string>",
"trading_start": "<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({stale_order_millis: 123, trading_end: '<string>', trading_start: '<string>'})
};
fetch('https://api.anthid.com/v1/controls/accounts/{account_id}/time', 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.anthid.com/v1/controls/accounts/{account_id}/time",
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([
'stale_order_millis' => 123,
'trading_end' => '<string>',
'trading_start' => '<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.anthid.com/v1/controls/accounts/{account_id}/time"
payload := strings.NewReader("{\n \"stale_order_millis\": 123,\n \"trading_end\": \"<string>\",\n \"trading_start\": \"<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.anthid.com/v1/controls/accounts/{account_id}/time")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"stale_order_millis\": 123,\n \"trading_end\": \"<string>\",\n \"trading_start\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anthid.com/v1/controls/accounts/{account_id}/time")
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 \"stale_order_millis\": 123,\n \"trading_end\": \"<string>\",\n \"trading_start\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"updated_at": "2023-11-07T05:31:56Z",
"version": 123,
"stale_order_millis": 123,
"trading_end": "<string>",
"trading_start": "<string>"
}"<string>""<string>""<string>""<string>""<string>"Authorizations
bearerAuthapiKeyAuth
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Trading account id
Body
application/json
Trading window and stale-order timeout settings for the account
Previous
Delete account time controlDeletes time-window controls for a trading account owned by the authenticated principal's organization. The caller must have Controls Premium and organization control edit access.
Next
⌘I
Upsert account time control
curl --request PUT \
--url https://api.anthid.com/v1/controls/accounts/{account_id}/time \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stale_order_millis": 123,
"trading_end": "<string>",
"trading_start": "<string>"
}
'import requests
url = "https://api.anthid.com/v1/controls/accounts/{account_id}/time"
payload = {
"stale_order_millis": 123,
"trading_end": "<string>",
"trading_start": "<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({stale_order_millis: 123, trading_end: '<string>', trading_start: '<string>'})
};
fetch('https://api.anthid.com/v1/controls/accounts/{account_id}/time', 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.anthid.com/v1/controls/accounts/{account_id}/time",
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([
'stale_order_millis' => 123,
'trading_end' => '<string>',
'trading_start' => '<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.anthid.com/v1/controls/accounts/{account_id}/time"
payload := strings.NewReader("{\n \"stale_order_millis\": 123,\n \"trading_end\": \"<string>\",\n \"trading_start\": \"<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.anthid.com/v1/controls/accounts/{account_id}/time")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"stale_order_millis\": 123,\n \"trading_end\": \"<string>\",\n \"trading_start\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.anthid.com/v1/controls/accounts/{account_id}/time")
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 \"stale_order_millis\": 123,\n \"trading_end\": \"<string>\",\n \"trading_start\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"account_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"updated_at": "2023-11-07T05:31:56Z",
"version": 123,
"stale_order_millis": 123,
"trading_end": "<string>",
"trading_start": "<string>"
}"<string>""<string>""<string>""<string>""<string>"