curl --request POST \
--url https://api.synci.io/api/v1/finance/accounts/{accountId}/positions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider_symbol": "<string>",
"quantity": 123
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({provider_symbol: '<string>', quantity: 123})
};
fetch('https://api.synci.io/api/v1/finance/accounts/{accountId}/positions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.synci.io/api/v1/finance/accounts/{accountId}/positions"
payload = {
"provider_symbol": "<string>",
"quantity": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.synci.io/api/v1/finance/accounts/{accountId}/positions",
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([
'provider_symbol' => '<string>',
'quantity' => 123
]),
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.synci.io/api/v1/finance/accounts/{accountId}/positions"
payload := strings.NewReader("{\n \"provider_symbol\": \"<string>\",\n \"quantity\": 123\n}")
req, _ := http.NewRequest("POST", 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))
}{
"message": "Position added.",
"data": {
"id": "<string>",
"financial_account_id": "<string>",
"security": {
"id": "<string>",
"provider": "MARKETSTACK",
"provider_symbol": "<string>",
"name": "<string>",
"type": "EQUITY",
"currency": "<string>",
"exchange_mic": "<string>",
"exchange_name": "<string>",
"country_code": "<string>",
"priced": true,
"price_status": "UNVERIFIED",
"last_price_at": "<string>"
},
"quantity": "<string>",
"opening_quantity": "<string>",
"cost_basis_total": 123,
"opening_cost_basis": 123,
"opened_at": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Add a position
The security must be priced: Synci fetches its latest close if it does not hold one, and refuses the
position with a 422 on provider_symbol when the provider has none. The account is valued at once, and
a past opened_at queues a backfill of the security’s price history so the value history exists from
that day.
curl --request POST \
--url https://api.synci.io/api/v1/finance/accounts/{accountId}/positions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"provider_symbol": "<string>",
"quantity": 123
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({provider_symbol: '<string>', quantity: 123})
};
fetch('https://api.synci.io/api/v1/finance/accounts/{accountId}/positions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.synci.io/api/v1/finance/accounts/{accountId}/positions"
payload = {
"provider_symbol": "<string>",
"quantity": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.synci.io/api/v1/finance/accounts/{accountId}/positions",
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([
'provider_symbol' => '<string>',
'quantity' => 123
]),
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.synci.io/api/v1/finance/accounts/{accountId}/positions"
payload := strings.NewReader("{\n \"provider_symbol\": \"<string>\",\n \"quantity\": 123\n}")
req, _ := http.NewRequest("POST", 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))
}{
"message": "Position added.",
"data": {
"id": "<string>",
"financial_account_id": "<string>",
"security": {
"id": "<string>",
"provider": "MARKETSTACK",
"provider_symbol": "<string>",
"name": "<string>",
"type": "EQUITY",
"currency": "<string>",
"exchange_mic": "<string>",
"exchange_name": "<string>",
"country_code": "<string>",
"priced": true,
"price_status": "UNVERIFIED",
"last_price_at": "<string>"
},
"quantity": "<string>",
"opening_quantity": "<string>",
"cost_basis_total": 123,
"opening_cost_basis": 123,
"opened_at": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
The financial account ID
Body
The security's symbol as the securities search returned it (exchange suffix included). Created in the catalogue on first use; must have a price.
32Units held on opened_at.
x <= 999999999999What those opening units cost in the account currency, fees included. Optional.
0 <= x <= 999999999999Deprecated alias of opening_cost_basis.
0 <= x <= 999999999999The day the position was opened. Defaults to today; a past date backfills the value history from there (up to ten years).