Update a position
curl --request PUT \
--url https://api.synci.io/api/v1/finance/accounts/{accountId}/positions/{positionId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"quantity": 123,
"opening_cost_basis": 499999999999.5,
"cost_basis_total": 499999999999.5,
"opened_at": "2023-11-07T05:31:56Z"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
quantity: 123,
opening_cost_basis: 499999999999.5,
cost_basis_total: 499999999999.5,
opened_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.synci.io/api/v1/finance/accounts/{accountId}/positions/{positionId}', 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/{positionId}"
payload = {
"quantity": 123,
"opening_cost_basis": 499999999999.5,
"cost_basis_total": 499999999999.5,
"opened_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(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/{positionId}",
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([
'quantity' => 123,
'opening_cost_basis' => 499999999999.5,
'cost_basis_total' => 499999999999.5,
'opened_at' => '2023-11-07T05:31:56Z'
]),
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/{positionId}"
payload := strings.NewReader("{\n \"quantity\": 123,\n \"opening_cost_basis\": 499999999999.5,\n \"cost_basis_total\": 499999999999.5,\n \"opened_at\": \"2023-11-07T05:31:56Z\"\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))
}{
"message": "Position updated.",
"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": {}
}Update a position
PUT
/
finance
/
accounts
/
{accountId}
/
positions
/
{positionId}
Update a position
curl --request PUT \
--url https://api.synci.io/api/v1/finance/accounts/{accountId}/positions/{positionId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"quantity": 123,
"opening_cost_basis": 499999999999.5,
"cost_basis_total": 499999999999.5,
"opened_at": "2023-11-07T05:31:56Z"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
quantity: 123,
opening_cost_basis: 499999999999.5,
cost_basis_total: 499999999999.5,
opened_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.synci.io/api/v1/finance/accounts/{accountId}/positions/{positionId}', 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/{positionId}"
payload = {
"quantity": 123,
"opening_cost_basis": 499999999999.5,
"cost_basis_total": 499999999999.5,
"opened_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(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/{positionId}",
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([
'quantity' => 123,
'opening_cost_basis' => 499999999999.5,
'cost_basis_total' => 499999999999.5,
'opened_at' => '2023-11-07T05:31:56Z'
]),
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/{positionId}"
payload := strings.NewReader("{\n \"quantity\": 123,\n \"opening_cost_basis\": 499999999999.5,\n \"cost_basis_total\": 499999999999.5,\n \"opened_at\": \"2023-11-07T05:31:56Z\"\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))
}{
"message": "Position updated.",
"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
oauth2http
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
The financial account ID
The position ID
Body
application/json
The units held now. The opening quantity absorbs the difference so the trades keep adding up.
Required range:
x <= 999999999999What the opening units cost in the account currency; null clears it. The running cost_basis_total is replayed from it and the trades.
Required range:
0 <= x <= 999999999999Deprecated alias of opening_cost_basis.
Required range:
0 <= x <= 999999999999The day the position was opened. An earlier date backfills the value history from there.