curl --request PUT \
--url https://api.example.com/api/graph/v1/strategies/{strategy_id} \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"universe": {
"type": "full_universe",
"symbols": [
"<string>"
],
"sector": "<string>",
"min_market_cap": 123,
"min_adv": 123,
"min_price": 123,
"max_price": 123
},
"rules": {
"entry_groups": [
{
"id": "<string>",
"conditions": [
{
"id": "<string>",
"indicator": "<string>",
"params": {},
"field": "<string>",
"update_frequency": "<string>",
"staleness_warn_sec": 43200,
"type": "<string>",
"value": 123,
"ref": "<string>",
"ref_offset": {
"coef": 0,
"ref": "<string>"
}
}
],
"action": "<string>",
"label": ""
}
],
"exit_groups": [
{
"id": "<string>",
"conditions": [
{
"id": "<string>",
"indicator": "<string>",
"params": {},
"field": "<string>",
"update_frequency": "<string>",
"staleness_warn_sec": 43200,
"type": "<string>",
"value": 123,
"ref": "<string>",
"ref_offset": {
"coef": 0,
"ref": "<string>"
}
}
],
"action": "<string>",
"label": ""
}
]
},
"cross_sectional_spec": {
"long_fraction": -0.5,
"ranking_feature": {
"source": "<string>",
"field": "<string>",
"schema_version": "pit-feature-v1",
"missing_policy": "fail_batch"
},
"lookback_days": 252,
"rebalance_freq": "monthly",
"direction": "long_only",
"short_fraction": 0.25,
"winsor_daily": 0.35
},
"risk_controls": {
"sizing_method": "fixed_risk",
"sizing_params": {},
"stop_losses": [
{
"id": "<string>",
"params": {}
}
],
"max_position_pct": 0.05,
"max_total_positions": 6,
"max_same_direction": 3,
"max_sector_concentration_pct": 0.4,
"max_loss_per_trade_dollars": 500,
"max_overnight_exposure_pct": 0.15,
"daily_pnl_limit_pct": -0.02,
"consecutive_loss_limit": 3,
"drawdown_limit_pct": -0.08
},
"canvas_layout": {
"nodes": {},
"active_group_id": "<string>",
"column_hints": {}
},
"contract_selection": {
"mode": "rule_based",
"direction": "auto",
"target_delta": 0.3,
"delta_tolerance": 0.1,
"dte_min": 7,
"dte_max": 45,
"option_type": "auto",
"min_open_interest": 10,
"max_spread_pct": 0.1,
"prefer_weekly": false
}
}
'import requests
url = "https://api.example.com/api/graph/v1/strategies/{strategy_id}"
payload = {
"name": "<string>",
"universe": {
"type": "full_universe",
"symbols": ["<string>"],
"sector": "<string>",
"min_market_cap": 123,
"min_adv": 123,
"min_price": 123,
"max_price": 123
},
"rules": {
"entry_groups": [
{
"id": "<string>",
"conditions": [
{
"id": "<string>",
"indicator": "<string>",
"params": {},
"field": "<string>",
"update_frequency": "<string>",
"staleness_warn_sec": 43200,
"type": "<string>",
"value": 123,
"ref": "<string>",
"ref_offset": {
"coef": 0,
"ref": "<string>"
}
}
],
"action": "<string>",
"label": ""
}
],
"exit_groups": [
{
"id": "<string>",
"conditions": [
{
"id": "<string>",
"indicator": "<string>",
"params": {},
"field": "<string>",
"update_frequency": "<string>",
"staleness_warn_sec": 43200,
"type": "<string>",
"value": 123,
"ref": "<string>",
"ref_offset": {
"coef": 0,
"ref": "<string>"
}
}
],
"action": "<string>",
"label": ""
}
]
},
"cross_sectional_spec": {
"long_fraction": -0.5,
"ranking_feature": {
"source": "<string>",
"field": "<string>",
"schema_version": "pit-feature-v1",
"missing_policy": "fail_batch"
},
"lookback_days": 252,
"rebalance_freq": "monthly",
"direction": "long_only",
"short_fraction": 0.25,
"winsor_daily": 0.35
},
"risk_controls": {
"sizing_method": "fixed_risk",
"sizing_params": {},
"stop_losses": [
{
"id": "<string>",
"params": {}
}
],
"max_position_pct": 0.05,
"max_total_positions": 6,
"max_same_direction": 3,
"max_sector_concentration_pct": 0.4,
"max_loss_per_trade_dollars": 500,
"max_overnight_exposure_pct": 0.15,
"daily_pnl_limit_pct": -0.02,
"consecutive_loss_limit": 3,
"drawdown_limit_pct": -0.08
},
"canvas_layout": {
"nodes": {},
"active_group_id": "<string>",
"column_hints": {}
},
"contract_selection": {
"mode": "rule_based",
"direction": "auto",
"target_delta": 0.3,
"delta_tolerance": 0.1,
"dte_min": 7,
"dte_max": 45,
"option_type": "auto",
"min_open_interest": 10,
"max_spread_pct": 0.1,
"prefer_weekly": False
}
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
universe: {
type: 'full_universe',
symbols: ['<string>'],
sector: '<string>',
min_market_cap: 123,
min_adv: 123,
min_price: 123,
max_price: 123
},
rules: {
entry_groups: [
{
id: '<string>',
conditions: [
{
id: '<string>',
indicator: '<string>',
params: {},
field: '<string>',
update_frequency: '<string>',
staleness_warn_sec: 43200,
type: '<string>',
value: 123,
ref: '<string>',
ref_offset: {coef: 0, ref: '<string>'}
}
],
action: '<string>',
label: ''
}
],
exit_groups: [
{
id: '<string>',
conditions: [
{
id: '<string>',
indicator: '<string>',
params: {},
field: '<string>',
update_frequency: '<string>',
staleness_warn_sec: 43200,
type: '<string>',
value: 123,
ref: '<string>',
ref_offset: {coef: 0, ref: '<string>'}
}
],
action: '<string>',
label: ''
}
]
},
cross_sectional_spec: {
long_fraction: -0.5,
ranking_feature: {
source: '<string>',
field: '<string>',
schema_version: 'pit-feature-v1',
missing_policy: 'fail_batch'
},
lookback_days: 252,
rebalance_freq: 'monthly',
direction: 'long_only',
short_fraction: 0.25,
winsor_daily: 0.35
},
risk_controls: {
sizing_method: 'fixed_risk',
sizing_params: {},
stop_losses: [{id: '<string>', params: {}}],
max_position_pct: 0.05,
max_total_positions: 6,
max_same_direction: 3,
max_sector_concentration_pct: 0.4,
max_loss_per_trade_dollars: 500,
max_overnight_exposure_pct: 0.15,
daily_pnl_limit_pct: -0.02,
consecutive_loss_limit: 3,
drawdown_limit_pct: -0.08
},
canvas_layout: {nodes: {}, active_group_id: '<string>', column_hints: {}},
contract_selection: {
mode: 'rule_based',
direction: 'auto',
target_delta: 0.3,
delta_tolerance: 0.1,
dte_min: 7,
dte_max: 45,
option_type: 'auto',
min_open_interest: 10,
max_spread_pct: 0.1,
prefer_weekly: false
}
})
};
fetch('https://api.example.com/api/graph/v1/strategies/{strategy_id}', 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/strategies/{strategy_id}",
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([
'name' => '<string>',
'universe' => [
'type' => 'full_universe',
'symbols' => [
'<string>'
],
'sector' => '<string>',
'min_market_cap' => 123,
'min_adv' => 123,
'min_price' => 123,
'max_price' => 123
],
'rules' => [
'entry_groups' => [
[
'id' => '<string>',
'conditions' => [
[
'id' => '<string>',
'indicator' => '<string>',
'params' => [
],
'field' => '<string>',
'update_frequency' => '<string>',
'staleness_warn_sec' => 43200,
'type' => '<string>',
'value' => 123,
'ref' => '<string>',
'ref_offset' => [
'coef' => 0,
'ref' => '<string>'
]
]
],
'action' => '<string>',
'label' => ''
]
],
'exit_groups' => [
[
'id' => '<string>',
'conditions' => [
[
'id' => '<string>',
'indicator' => '<string>',
'params' => [
],
'field' => '<string>',
'update_frequency' => '<string>',
'staleness_warn_sec' => 43200,
'type' => '<string>',
'value' => 123,
'ref' => '<string>',
'ref_offset' => [
'coef' => 0,
'ref' => '<string>'
]
]
],
'action' => '<string>',
'label' => ''
]
]
],
'cross_sectional_spec' => [
'long_fraction' => -0.5,
'ranking_feature' => [
'source' => '<string>',
'field' => '<string>',
'schema_version' => 'pit-feature-v1',
'missing_policy' => 'fail_batch'
],
'lookback_days' => 252,
'rebalance_freq' => 'monthly',
'direction' => 'long_only',
'short_fraction' => 0.25,
'winsor_daily' => 0.35
],
'risk_controls' => [
'sizing_method' => 'fixed_risk',
'sizing_params' => [
],
'stop_losses' => [
[
'id' => '<string>',
'params' => [
]
]
],
'max_position_pct' => 0.05,
'max_total_positions' => 6,
'max_same_direction' => 3,
'max_sector_concentration_pct' => 0.4,
'max_loss_per_trade_dollars' => 500,
'max_overnight_exposure_pct' => 0.15,
'daily_pnl_limit_pct' => -0.02,
'consecutive_loss_limit' => 3,
'drawdown_limit_pct' => -0.08
],
'canvas_layout' => [
'nodes' => [
],
'active_group_id' => '<string>',
'column_hints' => [
]
],
'contract_selection' => [
'mode' => 'rule_based',
'direction' => 'auto',
'target_delta' => 0.3,
'delta_tolerance' => 0.1,
'dte_min' => 7,
'dte_max' => 45,
'option_type' => 'auto',
'min_open_interest' => 10,
'max_spread_pct' => 0.1,
'prefer_weekly' => 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/graph/v1/strategies/{strategy_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"universe\": {\n \"type\": \"full_universe\",\n \"symbols\": [\n \"<string>\"\n ],\n \"sector\": \"<string>\",\n \"min_market_cap\": 123,\n \"min_adv\": 123,\n \"min_price\": 123,\n \"max_price\": 123\n },\n \"rules\": {\n \"entry_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ],\n \"exit_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ]\n },\n \"cross_sectional_spec\": {\n \"long_fraction\": -0.5,\n \"ranking_feature\": {\n \"source\": \"<string>\",\n \"field\": \"<string>\",\n \"schema_version\": \"pit-feature-v1\",\n \"missing_policy\": \"fail_batch\"\n },\n \"lookback_days\": 252,\n \"rebalance_freq\": \"monthly\",\n \"direction\": \"long_only\",\n \"short_fraction\": 0.25,\n \"winsor_daily\": 0.35\n },\n \"risk_controls\": {\n \"sizing_method\": \"fixed_risk\",\n \"sizing_params\": {},\n \"stop_losses\": [\n {\n \"id\": \"<string>\",\n \"params\": {}\n }\n ],\n \"max_position_pct\": 0.05,\n \"max_total_positions\": 6,\n \"max_same_direction\": 3,\n \"max_sector_concentration_pct\": 0.4,\n \"max_loss_per_trade_dollars\": 500,\n \"max_overnight_exposure_pct\": 0.15,\n \"daily_pnl_limit_pct\": -0.02,\n \"consecutive_loss_limit\": 3,\n \"drawdown_limit_pct\": -0.08\n },\n \"canvas_layout\": {\n \"nodes\": {},\n \"active_group_id\": \"<string>\",\n \"column_hints\": {}\n },\n \"contract_selection\": {\n \"mode\": \"rule_based\",\n \"direction\": \"auto\",\n \"target_delta\": 0.3,\n \"delta_tolerance\": 0.1,\n \"dte_min\": 7,\n \"dte_max\": 45,\n \"option_type\": \"auto\",\n \"min_open_interest\": 10,\n \"max_spread_pct\": 0.1,\n \"prefer_weekly\": false\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/api/graph/v1/strategies/{strategy_id}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"universe\": {\n \"type\": \"full_universe\",\n \"symbols\": [\n \"<string>\"\n ],\n \"sector\": \"<string>\",\n \"min_market_cap\": 123,\n \"min_adv\": 123,\n \"min_price\": 123,\n \"max_price\": 123\n },\n \"rules\": {\n \"entry_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ],\n \"exit_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ]\n },\n \"cross_sectional_spec\": {\n \"long_fraction\": -0.5,\n \"ranking_feature\": {\n \"source\": \"<string>\",\n \"field\": \"<string>\",\n \"schema_version\": \"pit-feature-v1\",\n \"missing_policy\": \"fail_batch\"\n },\n \"lookback_days\": 252,\n \"rebalance_freq\": \"monthly\",\n \"direction\": \"long_only\",\n \"short_fraction\": 0.25,\n \"winsor_daily\": 0.35\n },\n \"risk_controls\": {\n \"sizing_method\": \"fixed_risk\",\n \"sizing_params\": {},\n \"stop_losses\": [\n {\n \"id\": \"<string>\",\n \"params\": {}\n }\n ],\n \"max_position_pct\": 0.05,\n \"max_total_positions\": 6,\n \"max_same_direction\": 3,\n \"max_sector_concentration_pct\": 0.4,\n \"max_loss_per_trade_dollars\": 500,\n \"max_overnight_exposure_pct\": 0.15,\n \"daily_pnl_limit_pct\": -0.02,\n \"consecutive_loss_limit\": 3,\n \"drawdown_limit_pct\": -0.08\n },\n \"canvas_layout\": {\n \"nodes\": {},\n \"active_group_id\": \"<string>\",\n \"column_hints\": {}\n },\n \"contract_selection\": {\n \"mode\": \"rule_based\",\n \"direction\": \"auto\",\n \"target_delta\": 0.3,\n \"delta_tolerance\": 0.1,\n \"dte_min\": 7,\n \"dte_max\": 45,\n \"option_type\": \"auto\",\n \"min_open_interest\": 10,\n \"max_spread_pct\": 0.1,\n \"prefer_weekly\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/graph/v1/strategies/{strategy_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"universe\": {\n \"type\": \"full_universe\",\n \"symbols\": [\n \"<string>\"\n ],\n \"sector\": \"<string>\",\n \"min_market_cap\": 123,\n \"min_adv\": 123,\n \"min_price\": 123,\n \"max_price\": 123\n },\n \"rules\": {\n \"entry_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ],\n \"exit_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ]\n },\n \"cross_sectional_spec\": {\n \"long_fraction\": -0.5,\n \"ranking_feature\": {\n \"source\": \"<string>\",\n \"field\": \"<string>\",\n \"schema_version\": \"pit-feature-v1\",\n \"missing_policy\": \"fail_batch\"\n },\n \"lookback_days\": 252,\n \"rebalance_freq\": \"monthly\",\n \"direction\": \"long_only\",\n \"short_fraction\": 0.25,\n \"winsor_daily\": 0.35\n },\n \"risk_controls\": {\n \"sizing_method\": \"fixed_risk\",\n \"sizing_params\": {},\n \"stop_losses\": [\n {\n \"id\": \"<string>\",\n \"params\": {}\n }\n ],\n \"max_position_pct\": 0.05,\n \"max_total_positions\": 6,\n \"max_same_direction\": 3,\n \"max_sector_concentration_pct\": 0.4,\n \"max_loss_per_trade_dollars\": 500,\n \"max_overnight_exposure_pct\": 0.15,\n \"daily_pnl_limit_pct\": -0.02,\n \"consecutive_loss_limit\": 3,\n \"drawdown_limit_pct\": -0.08\n },\n \"canvas_layout\": {\n \"nodes\": {},\n \"active_group_id\": \"<string>\",\n \"column_hints\": {}\n },\n \"contract_selection\": {\n \"mode\": \"rule_based\",\n \"direction\": \"auto\",\n \"target_delta\": 0.3,\n \"delta_tolerance\": 0.1,\n \"dte_min\": 7,\n \"dte_max\": 45,\n \"option_type\": \"auto\",\n \"min_open_interest\": 10,\n \"max_spread_pct\": 0.1,\n \"prefer_weekly\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"instrument": "stocks",
"timeframe": "scalping",
"automation_level": "monitor",
"universe": {},
"risk_controls": {},
"deployment_phase": "backtest",
"deployment_ramp_pct": 123,
"version": 123,
"is_active": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"archetype": "<string>",
"strategy_kind": "rule_driven",
"rules": {},
"cross_sectional_spec": {},
"canvas_layout": {},
"contract_selection": {},
"forked_from_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"derived_from_strategy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"last_verdict": "shown_promise_for_regime"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Update Strategy
Update a strategy. Increments version and snapshots if rules change.
curl --request PUT \
--url https://api.example.com/api/graph/v1/strategies/{strategy_id} \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"universe": {
"type": "full_universe",
"symbols": [
"<string>"
],
"sector": "<string>",
"min_market_cap": 123,
"min_adv": 123,
"min_price": 123,
"max_price": 123
},
"rules": {
"entry_groups": [
{
"id": "<string>",
"conditions": [
{
"id": "<string>",
"indicator": "<string>",
"params": {},
"field": "<string>",
"update_frequency": "<string>",
"staleness_warn_sec": 43200,
"type": "<string>",
"value": 123,
"ref": "<string>",
"ref_offset": {
"coef": 0,
"ref": "<string>"
}
}
],
"action": "<string>",
"label": ""
}
],
"exit_groups": [
{
"id": "<string>",
"conditions": [
{
"id": "<string>",
"indicator": "<string>",
"params": {},
"field": "<string>",
"update_frequency": "<string>",
"staleness_warn_sec": 43200,
"type": "<string>",
"value": 123,
"ref": "<string>",
"ref_offset": {
"coef": 0,
"ref": "<string>"
}
}
],
"action": "<string>",
"label": ""
}
]
},
"cross_sectional_spec": {
"long_fraction": -0.5,
"ranking_feature": {
"source": "<string>",
"field": "<string>",
"schema_version": "pit-feature-v1",
"missing_policy": "fail_batch"
},
"lookback_days": 252,
"rebalance_freq": "monthly",
"direction": "long_only",
"short_fraction": 0.25,
"winsor_daily": 0.35
},
"risk_controls": {
"sizing_method": "fixed_risk",
"sizing_params": {},
"stop_losses": [
{
"id": "<string>",
"params": {}
}
],
"max_position_pct": 0.05,
"max_total_positions": 6,
"max_same_direction": 3,
"max_sector_concentration_pct": 0.4,
"max_loss_per_trade_dollars": 500,
"max_overnight_exposure_pct": 0.15,
"daily_pnl_limit_pct": -0.02,
"consecutive_loss_limit": 3,
"drawdown_limit_pct": -0.08
},
"canvas_layout": {
"nodes": {},
"active_group_id": "<string>",
"column_hints": {}
},
"contract_selection": {
"mode": "rule_based",
"direction": "auto",
"target_delta": 0.3,
"delta_tolerance": 0.1,
"dte_min": 7,
"dte_max": 45,
"option_type": "auto",
"min_open_interest": 10,
"max_spread_pct": 0.1,
"prefer_weekly": false
}
}
'import requests
url = "https://api.example.com/api/graph/v1/strategies/{strategy_id}"
payload = {
"name": "<string>",
"universe": {
"type": "full_universe",
"symbols": ["<string>"],
"sector": "<string>",
"min_market_cap": 123,
"min_adv": 123,
"min_price": 123,
"max_price": 123
},
"rules": {
"entry_groups": [
{
"id": "<string>",
"conditions": [
{
"id": "<string>",
"indicator": "<string>",
"params": {},
"field": "<string>",
"update_frequency": "<string>",
"staleness_warn_sec": 43200,
"type": "<string>",
"value": 123,
"ref": "<string>",
"ref_offset": {
"coef": 0,
"ref": "<string>"
}
}
],
"action": "<string>",
"label": ""
}
],
"exit_groups": [
{
"id": "<string>",
"conditions": [
{
"id": "<string>",
"indicator": "<string>",
"params": {},
"field": "<string>",
"update_frequency": "<string>",
"staleness_warn_sec": 43200,
"type": "<string>",
"value": 123,
"ref": "<string>",
"ref_offset": {
"coef": 0,
"ref": "<string>"
}
}
],
"action": "<string>",
"label": ""
}
]
},
"cross_sectional_spec": {
"long_fraction": -0.5,
"ranking_feature": {
"source": "<string>",
"field": "<string>",
"schema_version": "pit-feature-v1",
"missing_policy": "fail_batch"
},
"lookback_days": 252,
"rebalance_freq": "monthly",
"direction": "long_only",
"short_fraction": 0.25,
"winsor_daily": 0.35
},
"risk_controls": {
"sizing_method": "fixed_risk",
"sizing_params": {},
"stop_losses": [
{
"id": "<string>",
"params": {}
}
],
"max_position_pct": 0.05,
"max_total_positions": 6,
"max_same_direction": 3,
"max_sector_concentration_pct": 0.4,
"max_loss_per_trade_dollars": 500,
"max_overnight_exposure_pct": 0.15,
"daily_pnl_limit_pct": -0.02,
"consecutive_loss_limit": 3,
"drawdown_limit_pct": -0.08
},
"canvas_layout": {
"nodes": {},
"active_group_id": "<string>",
"column_hints": {}
},
"contract_selection": {
"mode": "rule_based",
"direction": "auto",
"target_delta": 0.3,
"delta_tolerance": 0.1,
"dte_min": 7,
"dte_max": 45,
"option_type": "auto",
"min_open_interest": 10,
"max_spread_pct": 0.1,
"prefer_weekly": False
}
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
universe: {
type: 'full_universe',
symbols: ['<string>'],
sector: '<string>',
min_market_cap: 123,
min_adv: 123,
min_price: 123,
max_price: 123
},
rules: {
entry_groups: [
{
id: '<string>',
conditions: [
{
id: '<string>',
indicator: '<string>',
params: {},
field: '<string>',
update_frequency: '<string>',
staleness_warn_sec: 43200,
type: '<string>',
value: 123,
ref: '<string>',
ref_offset: {coef: 0, ref: '<string>'}
}
],
action: '<string>',
label: ''
}
],
exit_groups: [
{
id: '<string>',
conditions: [
{
id: '<string>',
indicator: '<string>',
params: {},
field: '<string>',
update_frequency: '<string>',
staleness_warn_sec: 43200,
type: '<string>',
value: 123,
ref: '<string>',
ref_offset: {coef: 0, ref: '<string>'}
}
],
action: '<string>',
label: ''
}
]
},
cross_sectional_spec: {
long_fraction: -0.5,
ranking_feature: {
source: '<string>',
field: '<string>',
schema_version: 'pit-feature-v1',
missing_policy: 'fail_batch'
},
lookback_days: 252,
rebalance_freq: 'monthly',
direction: 'long_only',
short_fraction: 0.25,
winsor_daily: 0.35
},
risk_controls: {
sizing_method: 'fixed_risk',
sizing_params: {},
stop_losses: [{id: '<string>', params: {}}],
max_position_pct: 0.05,
max_total_positions: 6,
max_same_direction: 3,
max_sector_concentration_pct: 0.4,
max_loss_per_trade_dollars: 500,
max_overnight_exposure_pct: 0.15,
daily_pnl_limit_pct: -0.02,
consecutive_loss_limit: 3,
drawdown_limit_pct: -0.08
},
canvas_layout: {nodes: {}, active_group_id: '<string>', column_hints: {}},
contract_selection: {
mode: 'rule_based',
direction: 'auto',
target_delta: 0.3,
delta_tolerance: 0.1,
dte_min: 7,
dte_max: 45,
option_type: 'auto',
min_open_interest: 10,
max_spread_pct: 0.1,
prefer_weekly: false
}
})
};
fetch('https://api.example.com/api/graph/v1/strategies/{strategy_id}', 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/strategies/{strategy_id}",
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([
'name' => '<string>',
'universe' => [
'type' => 'full_universe',
'symbols' => [
'<string>'
],
'sector' => '<string>',
'min_market_cap' => 123,
'min_adv' => 123,
'min_price' => 123,
'max_price' => 123
],
'rules' => [
'entry_groups' => [
[
'id' => '<string>',
'conditions' => [
[
'id' => '<string>',
'indicator' => '<string>',
'params' => [
],
'field' => '<string>',
'update_frequency' => '<string>',
'staleness_warn_sec' => 43200,
'type' => '<string>',
'value' => 123,
'ref' => '<string>',
'ref_offset' => [
'coef' => 0,
'ref' => '<string>'
]
]
],
'action' => '<string>',
'label' => ''
]
],
'exit_groups' => [
[
'id' => '<string>',
'conditions' => [
[
'id' => '<string>',
'indicator' => '<string>',
'params' => [
],
'field' => '<string>',
'update_frequency' => '<string>',
'staleness_warn_sec' => 43200,
'type' => '<string>',
'value' => 123,
'ref' => '<string>',
'ref_offset' => [
'coef' => 0,
'ref' => '<string>'
]
]
],
'action' => '<string>',
'label' => ''
]
]
],
'cross_sectional_spec' => [
'long_fraction' => -0.5,
'ranking_feature' => [
'source' => '<string>',
'field' => '<string>',
'schema_version' => 'pit-feature-v1',
'missing_policy' => 'fail_batch'
],
'lookback_days' => 252,
'rebalance_freq' => 'monthly',
'direction' => 'long_only',
'short_fraction' => 0.25,
'winsor_daily' => 0.35
],
'risk_controls' => [
'sizing_method' => 'fixed_risk',
'sizing_params' => [
],
'stop_losses' => [
[
'id' => '<string>',
'params' => [
]
]
],
'max_position_pct' => 0.05,
'max_total_positions' => 6,
'max_same_direction' => 3,
'max_sector_concentration_pct' => 0.4,
'max_loss_per_trade_dollars' => 500,
'max_overnight_exposure_pct' => 0.15,
'daily_pnl_limit_pct' => -0.02,
'consecutive_loss_limit' => 3,
'drawdown_limit_pct' => -0.08
],
'canvas_layout' => [
'nodes' => [
],
'active_group_id' => '<string>',
'column_hints' => [
]
],
'contract_selection' => [
'mode' => 'rule_based',
'direction' => 'auto',
'target_delta' => 0.3,
'delta_tolerance' => 0.1,
'dte_min' => 7,
'dte_max' => 45,
'option_type' => 'auto',
'min_open_interest' => 10,
'max_spread_pct' => 0.1,
'prefer_weekly' => 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/graph/v1/strategies/{strategy_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"universe\": {\n \"type\": \"full_universe\",\n \"symbols\": [\n \"<string>\"\n ],\n \"sector\": \"<string>\",\n \"min_market_cap\": 123,\n \"min_adv\": 123,\n \"min_price\": 123,\n \"max_price\": 123\n },\n \"rules\": {\n \"entry_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ],\n \"exit_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ]\n },\n \"cross_sectional_spec\": {\n \"long_fraction\": -0.5,\n \"ranking_feature\": {\n \"source\": \"<string>\",\n \"field\": \"<string>\",\n \"schema_version\": \"pit-feature-v1\",\n \"missing_policy\": \"fail_batch\"\n },\n \"lookback_days\": 252,\n \"rebalance_freq\": \"monthly\",\n \"direction\": \"long_only\",\n \"short_fraction\": 0.25,\n \"winsor_daily\": 0.35\n },\n \"risk_controls\": {\n \"sizing_method\": \"fixed_risk\",\n \"sizing_params\": {},\n \"stop_losses\": [\n {\n \"id\": \"<string>\",\n \"params\": {}\n }\n ],\n \"max_position_pct\": 0.05,\n \"max_total_positions\": 6,\n \"max_same_direction\": 3,\n \"max_sector_concentration_pct\": 0.4,\n \"max_loss_per_trade_dollars\": 500,\n \"max_overnight_exposure_pct\": 0.15,\n \"daily_pnl_limit_pct\": -0.02,\n \"consecutive_loss_limit\": 3,\n \"drawdown_limit_pct\": -0.08\n },\n \"canvas_layout\": {\n \"nodes\": {},\n \"active_group_id\": \"<string>\",\n \"column_hints\": {}\n },\n \"contract_selection\": {\n \"mode\": \"rule_based\",\n \"direction\": \"auto\",\n \"target_delta\": 0.3,\n \"delta_tolerance\": 0.1,\n \"dte_min\": 7,\n \"dte_max\": 45,\n \"option_type\": \"auto\",\n \"min_open_interest\": 10,\n \"max_spread_pct\": 0.1,\n \"prefer_weekly\": false\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/api/graph/v1/strategies/{strategy_id}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"universe\": {\n \"type\": \"full_universe\",\n \"symbols\": [\n \"<string>\"\n ],\n \"sector\": \"<string>\",\n \"min_market_cap\": 123,\n \"min_adv\": 123,\n \"min_price\": 123,\n \"max_price\": 123\n },\n \"rules\": {\n \"entry_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ],\n \"exit_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ]\n },\n \"cross_sectional_spec\": {\n \"long_fraction\": -0.5,\n \"ranking_feature\": {\n \"source\": \"<string>\",\n \"field\": \"<string>\",\n \"schema_version\": \"pit-feature-v1\",\n \"missing_policy\": \"fail_batch\"\n },\n \"lookback_days\": 252,\n \"rebalance_freq\": \"monthly\",\n \"direction\": \"long_only\",\n \"short_fraction\": 0.25,\n \"winsor_daily\": 0.35\n },\n \"risk_controls\": {\n \"sizing_method\": \"fixed_risk\",\n \"sizing_params\": {},\n \"stop_losses\": [\n {\n \"id\": \"<string>\",\n \"params\": {}\n }\n ],\n \"max_position_pct\": 0.05,\n \"max_total_positions\": 6,\n \"max_same_direction\": 3,\n \"max_sector_concentration_pct\": 0.4,\n \"max_loss_per_trade_dollars\": 500,\n \"max_overnight_exposure_pct\": 0.15,\n \"daily_pnl_limit_pct\": -0.02,\n \"consecutive_loss_limit\": 3,\n \"drawdown_limit_pct\": -0.08\n },\n \"canvas_layout\": {\n \"nodes\": {},\n \"active_group_id\": \"<string>\",\n \"column_hints\": {}\n },\n \"contract_selection\": {\n \"mode\": \"rule_based\",\n \"direction\": \"auto\",\n \"target_delta\": 0.3,\n \"delta_tolerance\": 0.1,\n \"dte_min\": 7,\n \"dte_max\": 45,\n \"option_type\": \"auto\",\n \"min_open_interest\": 10,\n \"max_spread_pct\": 0.1,\n \"prefer_weekly\": false\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/graph/v1/strategies/{strategy_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"universe\": {\n \"type\": \"full_universe\",\n \"symbols\": [\n \"<string>\"\n ],\n \"sector\": \"<string>\",\n \"min_market_cap\": 123,\n \"min_adv\": 123,\n \"min_price\": 123,\n \"max_price\": 123\n },\n \"rules\": {\n \"entry_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ],\n \"exit_groups\": [\n {\n \"id\": \"<string>\",\n \"conditions\": [\n {\n \"id\": \"<string>\",\n \"indicator\": \"<string>\",\n \"params\": {},\n \"field\": \"<string>\",\n \"update_frequency\": \"<string>\",\n \"staleness_warn_sec\": 43200,\n \"type\": \"<string>\",\n \"value\": 123,\n \"ref\": \"<string>\",\n \"ref_offset\": {\n \"coef\": 0,\n \"ref\": \"<string>\"\n }\n }\n ],\n \"action\": \"<string>\",\n \"label\": \"\"\n }\n ]\n },\n \"cross_sectional_spec\": {\n \"long_fraction\": -0.5,\n \"ranking_feature\": {\n \"source\": \"<string>\",\n \"field\": \"<string>\",\n \"schema_version\": \"pit-feature-v1\",\n \"missing_policy\": \"fail_batch\"\n },\n \"lookback_days\": 252,\n \"rebalance_freq\": \"monthly\",\n \"direction\": \"long_only\",\n \"short_fraction\": 0.25,\n \"winsor_daily\": 0.35\n },\n \"risk_controls\": {\n \"sizing_method\": \"fixed_risk\",\n \"sizing_params\": {},\n \"stop_losses\": [\n {\n \"id\": \"<string>\",\n \"params\": {}\n }\n ],\n \"max_position_pct\": 0.05,\n \"max_total_positions\": 6,\n \"max_same_direction\": 3,\n \"max_sector_concentration_pct\": 0.4,\n \"max_loss_per_trade_dollars\": 500,\n \"max_overnight_exposure_pct\": 0.15,\n \"daily_pnl_limit_pct\": -0.02,\n \"consecutive_loss_limit\": 3,\n \"drawdown_limit_pct\": -0.08\n },\n \"canvas_layout\": {\n \"nodes\": {},\n \"active_group_id\": \"<string>\",\n \"column_hints\": {}\n },\n \"contract_selection\": {\n \"mode\": \"rule_based\",\n \"direction\": \"auto\",\n \"target_delta\": 0.3,\n \"delta_tolerance\": 0.1,\n \"dte_min\": 7,\n \"dte_max\": 45,\n \"option_type\": \"auto\",\n \"min_open_interest\": 10,\n \"max_spread_pct\": 0.1,\n \"prefer_weekly\": false\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"instrument": "stocks",
"timeframe": "scalping",
"automation_level": "monitor",
"universe": {},
"risk_controls": {},
"deployment_phase": "backtest",
"deployment_ramp_pct": 123,
"version": 123,
"is_active": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"archetype": "<string>",
"strategy_kind": "rule_driven",
"rules": {},
"cross_sectional_spec": {},
"canvas_layout": {},
"contract_selection": {},
"forked_from_run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"derived_from_strategy_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"last_verdict": "shown_promise_for_regime"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Path Parameters
Body
200mean_reversion, trend_following, momentum, volatility, custom stocks, options, both scalping, intraday, swing monitor, supervised, autonomous Show child attributes
Show child attributes
Orthogonal structural discriminator (NOT a behavioral archetype).
rule_driven -> per-symbol entry/exit rules (StrategyRules) cross_sectional -> rank the universe → basket → vol-scale (CrossSectionalSpec)
rule_driven, cross_sectional Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Typed strategy.canvas_layout JSONB shape — security review M1 fix.
The frontend's CanvasLayoutPersisted interface in
lib/canvas/types.ts is the source of truth for the shape; this
Pydantic model enforces the contract at the API boundary so
malformed writes are rejected with 422 rather than silently
corrupting the user's canvas state.
Show child attributes
Show child attributes
Rule-based options contract selection.
Maps directly to ContractCriteria in contract_recommender.py via contract_selection_bridge.config_to_criteria().
- RuleBasedContractConfig
- SpecificContractConfig
Show child attributes
Show child attributes
shown_promise_for_regime, not_yet, rejected Response
Successful Response
stocks, options, both scalping, intraday, swing monitor, supervised, autonomous backtest, paper, shadow, live shown_promise_for_regime, not_yet, rejected