Record a trade outcome
curl --request POST \
--url https://api.example.com/api/uat/v1/trades \
--header 'Content-Type: application/json' \
--data '
{
"symbol": "<string>",
"entry_time": "2023-11-07T05:31:56Z",
"entry_price": 1,
"quantity": 123,
"exit_time": "2023-11-07T05:31:56Z",
"exit_price": 1,
"pnl_dollars": 123,
"pnl_percent": 123,
"scan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action_card_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tradestation_order_id": "<string>",
"confluence_score": 50,
"net_confluence": 0,
"directional_bias": "<string>",
"day_type": "<string>",
"vix_regime": "<string>",
"account_tier": 2,
"is_cancelled": false
}
'import requests
url = "https://api.example.com/api/uat/v1/trades"
payload = {
"symbol": "<string>",
"entry_time": "2023-11-07T05:31:56Z",
"entry_price": 1,
"quantity": 123,
"exit_time": "2023-11-07T05:31:56Z",
"exit_price": 1,
"pnl_dollars": 123,
"pnl_percent": 123,
"scan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action_card_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tradestation_order_id": "<string>",
"confluence_score": 50,
"net_confluence": 0,
"directional_bias": "<string>",
"day_type": "<string>",
"vix_regime": "<string>",
"account_tier": 2,
"is_cancelled": False
}
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({
symbol: '<string>',
entry_time: '2023-11-07T05:31:56Z',
entry_price: 1,
quantity: 123,
exit_time: '2023-11-07T05:31:56Z',
exit_price: 1,
pnl_dollars: 123,
pnl_percent: 123,
scan_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
action_card_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
position_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
variant_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
tradestation_order_id: '<string>',
confluence_score: 50,
net_confluence: 0,
directional_bias: '<string>',
day_type: '<string>',
vix_regime: '<string>',
account_tier: 2,
is_cancelled: false
})
};
fetch('https://api.example.com/api/uat/v1/trades', 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/uat/v1/trades",
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([
'symbol' => '<string>',
'entry_time' => '2023-11-07T05:31:56Z',
'entry_price' => 1,
'quantity' => 123,
'exit_time' => '2023-11-07T05:31:56Z',
'exit_price' => 1,
'pnl_dollars' => 123,
'pnl_percent' => 123,
'scan_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'action_card_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'position_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'variant_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'tradestation_order_id' => '<string>',
'confluence_score' => 50,
'net_confluence' => 0,
'directional_bias' => '<string>',
'day_type' => '<string>',
'vix_regime' => '<string>',
'account_tier' => 2,
'is_cancelled' => false
]),
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/uat/v1/trades"
payload := strings.NewReader("{\n \"symbol\": \"<string>\",\n \"entry_time\": \"2023-11-07T05:31:56Z\",\n \"entry_price\": 1,\n \"quantity\": 123,\n \"exit_time\": \"2023-11-07T05:31:56Z\",\n \"exit_price\": 1,\n \"pnl_dollars\": 123,\n \"pnl_percent\": 123,\n \"scan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_card_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"position_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tradestation_order_id\": \"<string>\",\n \"confluence_score\": 50,\n \"net_confluence\": 0,\n \"directional_bias\": \"<string>\",\n \"day_type\": \"<string>\",\n \"vix_regime\": \"<string>\",\n \"account_tier\": 2,\n \"is_cancelled\": false\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/uat/v1/trades")
.header("Content-Type", "application/json")
.body("{\n \"symbol\": \"<string>\",\n \"entry_time\": \"2023-11-07T05:31:56Z\",\n \"entry_price\": 1,\n \"quantity\": 123,\n \"exit_time\": \"2023-11-07T05:31:56Z\",\n \"exit_price\": 1,\n \"pnl_dollars\": 123,\n \"pnl_percent\": 123,\n \"scan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_card_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"position_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tradestation_order_id\": \"<string>\",\n \"confluence_score\": 50,\n \"net_confluence\": 0,\n \"directional_bias\": \"<string>\",\n \"day_type\": \"<string>\",\n \"vix_regime\": \"<string>\",\n \"account_tier\": 2,\n \"is_cancelled\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/uat/v1/trades")
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 \"symbol\": \"<string>\",\n \"entry_time\": \"2023-11-07T05:31:56Z\",\n \"entry_price\": 1,\n \"quantity\": 123,\n \"exit_time\": \"2023-11-07T05:31:56Z\",\n \"exit_price\": 1,\n \"pnl_dollars\": 123,\n \"pnl_percent\": 123,\n \"scan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_card_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"position_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tradestation_order_id\": \"<string>\",\n \"confluence_score\": 50,\n \"net_confluence\": 0,\n \"directional_bias\": \"<string>\",\n \"day_type\": \"<string>\",\n \"vix_regime\": \"<string>\",\n \"account_tier\": 2,\n \"is_cancelled\": false\n}"
response = http.request(request)
puts response.read_body{
"outcome_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"entry_time": "2023-11-07T05:31:56Z",
"exit_time": "2023-11-07T05:31:56Z",
"recorded_at": "2023-11-07T05:31:56Z",
"trade_status": "pending",
"scan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action_card_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tradestation_order_id": "<string>",
"symbol": "<string>",
"direction": "long",
"entry_price": "<string>",
"exit_price": "<string>",
"quantity": 123,
"pnl_dollars": "<string>",
"pnl_percent": "<string>",
"is_winner": true,
"hold_duration_m": 123,
"confluence_tier": "EXCELLENT",
"confluence_score": "<string>",
"day_type": "<string>",
"vix_regime": "<string>",
"account_tier": 123,
"outcome_source": "tradestation_api",
"net_confluence": "<string>",
"directional_bias": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}UAT Testing
Record a trade outcome
Record a trade outcome for UAT analysis.
Trade Status Inference
- If
is_cancelled=True-> status = ‘cancelled’ - If exit_time, exit_price, AND pnl_dollars ALL present -> status = ‘closed’
- If NONE of them present -> status = ‘pending’
Required Fields
- symbol, direction, entry_time, entry_price, quantity, outcome_source
Optional Context
- confluence_tier, confluence_score, net_confluence, directional_bias
- day_type, vix_regime, account_tier
- scan_id, action_card_id, variant_id (for linking)
POST
/
api
/
uat
/
v1
/
trades
Record a trade outcome
curl --request POST \
--url https://api.example.com/api/uat/v1/trades \
--header 'Content-Type: application/json' \
--data '
{
"symbol": "<string>",
"entry_time": "2023-11-07T05:31:56Z",
"entry_price": 1,
"quantity": 123,
"exit_time": "2023-11-07T05:31:56Z",
"exit_price": 1,
"pnl_dollars": 123,
"pnl_percent": 123,
"scan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action_card_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tradestation_order_id": "<string>",
"confluence_score": 50,
"net_confluence": 0,
"directional_bias": "<string>",
"day_type": "<string>",
"vix_regime": "<string>",
"account_tier": 2,
"is_cancelled": false
}
'import requests
url = "https://api.example.com/api/uat/v1/trades"
payload = {
"symbol": "<string>",
"entry_time": "2023-11-07T05:31:56Z",
"entry_price": 1,
"quantity": 123,
"exit_time": "2023-11-07T05:31:56Z",
"exit_price": 1,
"pnl_dollars": 123,
"pnl_percent": 123,
"scan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action_card_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tradestation_order_id": "<string>",
"confluence_score": 50,
"net_confluence": 0,
"directional_bias": "<string>",
"day_type": "<string>",
"vix_regime": "<string>",
"account_tier": 2,
"is_cancelled": False
}
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({
symbol: '<string>',
entry_time: '2023-11-07T05:31:56Z',
entry_price: 1,
quantity: 123,
exit_time: '2023-11-07T05:31:56Z',
exit_price: 1,
pnl_dollars: 123,
pnl_percent: 123,
scan_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
action_card_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
position_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
variant_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
tradestation_order_id: '<string>',
confluence_score: 50,
net_confluence: 0,
directional_bias: '<string>',
day_type: '<string>',
vix_regime: '<string>',
account_tier: 2,
is_cancelled: false
})
};
fetch('https://api.example.com/api/uat/v1/trades', 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/uat/v1/trades",
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([
'symbol' => '<string>',
'entry_time' => '2023-11-07T05:31:56Z',
'entry_price' => 1,
'quantity' => 123,
'exit_time' => '2023-11-07T05:31:56Z',
'exit_price' => 1,
'pnl_dollars' => 123,
'pnl_percent' => 123,
'scan_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'action_card_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'position_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'variant_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'tradestation_order_id' => '<string>',
'confluence_score' => 50,
'net_confluence' => 0,
'directional_bias' => '<string>',
'day_type' => '<string>',
'vix_regime' => '<string>',
'account_tier' => 2,
'is_cancelled' => false
]),
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/uat/v1/trades"
payload := strings.NewReader("{\n \"symbol\": \"<string>\",\n \"entry_time\": \"2023-11-07T05:31:56Z\",\n \"entry_price\": 1,\n \"quantity\": 123,\n \"exit_time\": \"2023-11-07T05:31:56Z\",\n \"exit_price\": 1,\n \"pnl_dollars\": 123,\n \"pnl_percent\": 123,\n \"scan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_card_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"position_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tradestation_order_id\": \"<string>\",\n \"confluence_score\": 50,\n \"net_confluence\": 0,\n \"directional_bias\": \"<string>\",\n \"day_type\": \"<string>\",\n \"vix_regime\": \"<string>\",\n \"account_tier\": 2,\n \"is_cancelled\": false\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/uat/v1/trades")
.header("Content-Type", "application/json")
.body("{\n \"symbol\": \"<string>\",\n \"entry_time\": \"2023-11-07T05:31:56Z\",\n \"entry_price\": 1,\n \"quantity\": 123,\n \"exit_time\": \"2023-11-07T05:31:56Z\",\n \"exit_price\": 1,\n \"pnl_dollars\": 123,\n \"pnl_percent\": 123,\n \"scan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_card_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"position_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tradestation_order_id\": \"<string>\",\n \"confluence_score\": 50,\n \"net_confluence\": 0,\n \"directional_bias\": \"<string>\",\n \"day_type\": \"<string>\",\n \"vix_regime\": \"<string>\",\n \"account_tier\": 2,\n \"is_cancelled\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/uat/v1/trades")
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 \"symbol\": \"<string>\",\n \"entry_time\": \"2023-11-07T05:31:56Z\",\n \"entry_price\": 1,\n \"quantity\": 123,\n \"exit_time\": \"2023-11-07T05:31:56Z\",\n \"exit_price\": 1,\n \"pnl_dollars\": 123,\n \"pnl_percent\": 123,\n \"scan_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"action_card_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"position_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"variant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"tradestation_order_id\": \"<string>\",\n \"confluence_score\": 50,\n \"net_confluence\": 0,\n \"directional_bias\": \"<string>\",\n \"day_type\": \"<string>\",\n \"vix_regime\": \"<string>\",\n \"account_tier\": 2,\n \"is_cancelled\": false\n}"
response = http.request(request)
puts response.read_body{
"outcome_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"entry_time": "2023-11-07T05:31:56Z",
"exit_time": "2023-11-07T05:31:56Z",
"recorded_at": "2023-11-07T05:31:56Z",
"trade_status": "pending",
"scan_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action_card_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"position_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tradestation_order_id": "<string>",
"symbol": "<string>",
"direction": "long",
"entry_price": "<string>",
"exit_price": "<string>",
"quantity": 123,
"pnl_dollars": "<string>",
"pnl_percent": "<string>",
"is_winner": true,
"hold_duration_m": 123,
"confluence_tier": "EXCELLENT",
"confluence_score": "<string>",
"day_type": "<string>",
"vix_regime": "<string>",
"account_tier": 123,
"outcome_source": "tradestation_api",
"net_confluence": "<string>",
"directional_bias": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
application/json
Request model for recording a trade outcome.
trade_status is auto-inferred from provided fields:
- If is_cancelled=True -> 'cancelled'
- If exit_time, exit_price, AND pnl_dollars ALL present -> 'closed'
- If NONE of them present -> 'pending'
- Partial data -> validation error
Required string length:
1 - 10Trade direction: long or short.
Available options:
long, short Required range:
x > 0Source of trade outcome data.
Available options:
tradestation_api, manual_cli, journal_import Required range:
x > 0Maximum string length:
50Confluence tier classification.
Available options:
EXCELLENT, GOOD, MODERATE, WEAK, POOR Required range:
0 <= x <= 100Net confluence (-100 to +100): bullish_confluence - bearish_confluence
Required range:
-100 <= x <= 100Directional bias: STRONG_LONG, MOD_LONG, NEUTRAL, MOD_SHORT, STRONG_SHORT
Maximum string length:
20Maximum string length:
20Maximum string length:
20Required range:
1 <= x <= 3Explicitly mark trade as cancelled (pnl must be None)
Response
Successful Response
Full trade outcome model with server-generated fields.
Trade lifecycle status.
Available options:
pending, closed, cancelled Trade direction: long or short.
Available options:
long, short Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Confluence tier classification.
Available options:
EXCELLENT, GOOD, MODERATE, WEAK, POOR Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Source of trade outcome data.
Available options:
tradestation_api, manual_cli, journal_import Pattern:
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$