Start trade execution from debate
curl --request POST \
--url https://api.example.com/api/graph/v1/execution/start \
--header 'Content-Type: application/json' \
--data '
{
"debate_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timeframe": "swing",
"risk_appetite": "moderate",
"account_value": 1,
"account_tier": 2
}
'import requests
url = "https://api.example.com/api/graph/v1/execution/start"
payload = {
"debate_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timeframe": "swing",
"risk_appetite": "moderate",
"account_value": 1,
"account_tier": 2
}
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({
debate_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
timeframe: 'swing',
risk_appetite: 'moderate',
account_value: 1,
account_tier: 2
})
};
fetch('https://api.example.com/api/graph/v1/execution/start', 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/graph/v1/execution/start",
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([
'debate_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'timeframe' => 'swing',
'risk_appetite' => 'moderate',
'account_value' => 1,
'account_tier' => 2
]),
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/graph/v1/execution/start"
payload := strings.NewReader("{\n \"debate_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"timeframe\": \"swing\",\n \"risk_appetite\": \"moderate\",\n \"account_value\": 1,\n \"account_tier\": 2\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/graph/v1/execution/start")
.header("Content-Type", "application/json")
.body("{\n \"debate_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"timeframe\": \"swing\",\n \"risk_appetite\": \"moderate\",\n \"account_value\": 1,\n \"account_tier\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/graph/v1/execution/start")
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 \"debate_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"timeframe\": \"swing\",\n \"risk_appetite\": \"moderate\",\n \"account_value\": 1,\n \"account_tier\": 2\n}"
response = http.request(request)
puts response.read_body{
"execution": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"symbol": "<string>",
"direction": "long",
"execution_mode": "assisted",
"status": "strategy_generated",
"debate_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"strategy_name": "<string>",
"instrument_type": "option",
"contract_symbol": "<string>",
"entry_order_id": "<string>",
"entry_price": "<string>",
"entry_quantity": 123,
"entry_filled_at": "2023-11-07T05:31:56Z",
"exit_order_id": "<string>",
"exit_price": "<string>",
"exit_quantity": 123,
"exit_filled_at": "2023-11-07T05:31:56Z",
"exit_reason": "<string>",
"realized_pnl": "<string>",
"realized_pnl_pct": "<string>",
"max_favorable_excursion": "<string>",
"max_adverse_excursion": "<string>",
"risk_dollars": "<string>",
"initial_stop": "<string>",
"current_stop": "<string>",
"trading_mode": "paper",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"strategy_plan": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"trade_execution_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"strategy_name": "<string>",
"direction": "long",
"entry_plan": {},
"exit_plan": {},
"position_sizing": {},
"contract_symbol": "<string>",
"contract_type": "<string>",
"strike": "<string>",
"expiration": "<string>",
"target_delta": "<string>",
"invalidation_price": "<string>",
"model_used": "<string>",
"tokens_used": 123,
"generation_latency_ms": 123,
"created_at": "2023-11-07T05:31:56Z"
},
"recent_state_log": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"trade_execution_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z",
"from_status": "strategy_generated",
"to_status": "strategy_generated",
"trigger": "<string>",
"agent_phase": "strategy",
"reasoning": "<string>",
"metadata": {}
}
],
"risk_validation": {
"passed": true,
"checks": [
{
"rule_name": "<string>",
"passed": true,
"action": "<string>",
"message": "<string>",
"current_value": "<string>",
"limit_value": "<string>"
}
],
"blocked_reasons": [
"<string>"
],
"size_modifier": "1.0",
"sized_position_pct": 123,
"sizing_adjustments": {},
"or05_decision": {}
}
}Execution
Start trade execution from debate
Start the trade execution workflow from a debate result.
Workflow
- Loads the debate result from database
- Calls the strategy agent to generate a TradingStrategy
- Runs risk guardian pre-trade validation
- Creates the trade execution record
- Registers with the Go trade-executor service
- Returns ExecutionResponse with strategy plan and risk validation
Requirements
- Valid debate_id from a completed debate
- Execution system must be enabled
- Risk validation must pass (or trade is rejected)
Trading Mode
Uses the configured trading mode (paper/live). Paper and live use the same code paths; only the Alpaca base URL differs.
POST
/
api
/
graph
/
v1
/
execution
/
start
Start trade execution from debate
curl --request POST \
--url https://api.example.com/api/graph/v1/execution/start \
--header 'Content-Type: application/json' \
--data '
{
"debate_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timeframe": "swing",
"risk_appetite": "moderate",
"account_value": 1,
"account_tier": 2
}
'import requests
url = "https://api.example.com/api/graph/v1/execution/start"
payload = {
"debate_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timeframe": "swing",
"risk_appetite": "moderate",
"account_value": 1,
"account_tier": 2
}
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({
debate_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
timeframe: 'swing',
risk_appetite: 'moderate',
account_value: 1,
account_tier: 2
})
};
fetch('https://api.example.com/api/graph/v1/execution/start', 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/graph/v1/execution/start",
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([
'debate_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'timeframe' => 'swing',
'risk_appetite' => 'moderate',
'account_value' => 1,
'account_tier' => 2
]),
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/graph/v1/execution/start"
payload := strings.NewReader("{\n \"debate_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"timeframe\": \"swing\",\n \"risk_appetite\": \"moderate\",\n \"account_value\": 1,\n \"account_tier\": 2\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/graph/v1/execution/start")
.header("Content-Type", "application/json")
.body("{\n \"debate_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"timeframe\": \"swing\",\n \"risk_appetite\": \"moderate\",\n \"account_value\": 1,\n \"account_tier\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/graph/v1/execution/start")
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 \"debate_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"timeframe\": \"swing\",\n \"risk_appetite\": \"moderate\",\n \"account_value\": 1,\n \"account_tier\": 2\n}"
response = http.request(request)
puts response.read_body{
"execution": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"symbol": "<string>",
"direction": "long",
"execution_mode": "assisted",
"status": "strategy_generated",
"debate_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"strategy_name": "<string>",
"instrument_type": "option",
"contract_symbol": "<string>",
"entry_order_id": "<string>",
"entry_price": "<string>",
"entry_quantity": 123,
"entry_filled_at": "2023-11-07T05:31:56Z",
"exit_order_id": "<string>",
"exit_price": "<string>",
"exit_quantity": 123,
"exit_filled_at": "2023-11-07T05:31:56Z",
"exit_reason": "<string>",
"realized_pnl": "<string>",
"realized_pnl_pct": "<string>",
"max_favorable_excursion": "<string>",
"max_adverse_excursion": "<string>",
"risk_dollars": "<string>",
"initial_stop": "<string>",
"current_stop": "<string>",
"trading_mode": "paper",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"strategy_plan": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"trade_execution_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"strategy_name": "<string>",
"direction": "long",
"entry_plan": {},
"exit_plan": {},
"position_sizing": {},
"contract_symbol": "<string>",
"contract_type": "<string>",
"strike": "<string>",
"expiration": "<string>",
"target_delta": "<string>",
"invalidation_price": "<string>",
"model_used": "<string>",
"tokens_used": 123,
"generation_latency_ms": 123,
"created_at": "2023-11-07T05:31:56Z"
},
"recent_state_log": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"trade_execution_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"timestamp": "2023-11-07T05:31:56Z",
"from_status": "strategy_generated",
"to_status": "strategy_generated",
"trigger": "<string>",
"agent_phase": "strategy",
"reasoning": "<string>",
"metadata": {}
}
],
"risk_validation": {
"passed": true,
"checks": [
{
"rule_name": "<string>",
"passed": true,
"action": "<string>",
"message": "<string>",
"current_value": "<string>",
"limit_value": "<string>"
}
],
"blocked_reasons": [
"<string>"
],
"size_modifier": "1.0",
"sized_position_pct": 123,
"sizing_adjustments": {},
"or05_decision": {}
}
}Body
application/json
Request to start trade execution from a debate result.
Source debate UUID
Trading timeframe (day, swing, position)
Risk appetite (conservative, moderate, aggressive)
Account value for sizing (uses default if not provided)
Required range:
x > 0Account tier (1=starter, 2=intermediate, 3=advanced)
Required range:
1 <= x <= 3Response
Execution started successfully
Full trade execution state response.
Current trade execution state
Show child attributes
Show child attributes
Active strategy plan
Show child attributes
Show child attributes
Recent state transition log entries (last 10)
Show child attributes
Show child attributes
Latest risk validation result
Show child attributes
Show child attributes