Compute and ingest Alpaca borrow status
curl --request POST \
--url https://api.example.com/api/internal/borrow/compute \
--header 'Content-Type: application/json' \
--data '
{
"as_of": "2023-12-25"
}
'import requests
url = "https://api.example.com/api/internal/borrow/compute"
payload = { "as_of": "2023-12-25" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({as_of: '2023-12-25'})
};
fetch('https://api.example.com/api/internal/borrow/compute', 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.example.com/api/internal/borrow/compute",
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([
'as_of' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/internal/borrow/compute"
payload := strings.NewReader("{\n \"as_of\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/api/internal/borrow/compute")
.header("Content-Type", "application/json")
.body("{\n \"as_of\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/internal/borrow/compute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"as_of\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"rows_inserted": 123,
"as_of": "2023-12-25"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}borrow
Compute and ingest Alpaca borrow status
Fetch the current Alpaca borrow-status snapshot and insert it into
borrow_status_daily, dated as_of (default: the most recent trading
day — the daily-timer call).
Runs synchronously — a single full-universe /v2/assets fetch + insert
completes well within normal HTTP timeouts, same posture as
POST /api/internal/ssr/compute.
POST
/
api
/
internal
/
borrow
/
compute
Compute and ingest Alpaca borrow status
curl --request POST \
--url https://api.example.com/api/internal/borrow/compute \
--header 'Content-Type: application/json' \
--data '
{
"as_of": "2023-12-25"
}
'import requests
url = "https://api.example.com/api/internal/borrow/compute"
payload = { "as_of": "2023-12-25" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({as_of: '2023-12-25'})
};
fetch('https://api.example.com/api/internal/borrow/compute', 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.example.com/api/internal/borrow/compute",
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([
'as_of' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/api/internal/borrow/compute"
payload := strings.NewReader("{\n \"as_of\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.example.com/api/internal/borrow/compute")
.header("Content-Type", "application/json")
.body("{\n \"as_of\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/internal/borrow/compute")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"as_of\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"rows_inserted": 123,
"as_of": "2023-12-25"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
application/json
Request body for POST /api/internal/borrow/compute.
as_of defaults to get_most_recent_trading_day() when omitted (the
daily-timer call) -- Alpaca's /v2/assets payload is current-status-only
(no history), so as_of is simply the label attached to today's
snapshot, not a window to backfill.
Snapshot date to record rows under.