{"openapi": "3.1.0", "info": {"title": "CrossTrade API", "version": "1.0.0", "description": "The CrossTrade API provides programmatic access to NinjaTrader 8 through the CrossTrade add-on.\n\n## Architecture\n\nAll API calls require an active NinjaTrader 8 instance with the CrossTrade add-on connected.\nRequests are forwarded via RPC to the add-on running on your machine.\n\n**Two access methods:**\n1. **REST API** (this spec) \u2014 Standard HTTP endpoints at `/v1/api/*`\n2. **WebSocket API** \u2014 Connect to `/ws/stream` for real-time data and RPC\n\n## Authentication\n\nAll endpoints require a Bearer token in the `Authorization` header.\nAPI access requires a **Pro subscription**.\n\n## Rate Limits\n\n- **180 requests/minute** per user (shared across HTTP and WebSocket)\n- **20-request burst** allowance\n- Market data subscription changes: ~20/minute\n\n## WebSocket API\n\nConnect to `/ws/stream` for real-time market data, PnL streaming, and RPC calls.\n\n### Actions\n\n| Action | Description |\n|--------|-------------|\n| `rpc` | Call any RPC function: `{\"action\": \"rpc\", \"id\": \"req-1\", \"api\": \"PlaceOrder\", \"args\": {...}}` |\n| `subscribe` | Subscribe to market data: `{\"action\": \"subscribe\", \"instruments\": [\"ES 03-26\"]}` |\n| `unsubscribe` | Unsubscribe: `{\"action\": \"unsubscribe\", \"instruments\": [\"ES 03-26\"]}` |\n| `streamPnl` | Toggle PnL streaming: `{\"action\": \"streamPnl\", \"enabled\": true, \"interval\": 1000}` |\n| `ping` | Keepalive: `{\"action\": \"ping\"}` |\n\n### Events Received\n\n| Type | Description |\n|------|-------------|\n| `marketData` | `{\"type\": \"marketData\", \"quotes\": [...]}` |\n| `pnlUpdate` | `{\"type\": \"pnlUpdate\", \"epoch\": ..., \"accounts\": [...]}` |\n| RPC response | `{\"id\": \"req-1\", \"data\": {...}}` |\n", "contact": {"name": "CrossTrade", "url": "https://crosstrade.io"}, "x-llms-txt": "https://app.crosstrade.io/v1/api/llms.txt", "x-llms-full-txt": "https://app.crosstrade.io/v1/api/llms-full.txt", "x-mcp-endpoint": "https://app.crosstrade.io/v1/api/mcp", "x-mcp-server-card": "https://app.crosstrade.io/.well-known/mcp/server-card.json"}, "servers": [{"url": "https://app.crosstrade.io", "description": "Production"}, {"url": "https://dev.crosstrade.io", "description": "Development"}], "security": [{"bearerAuth": []}], "paths": {"/v1/api/accounts/{account}/watermarks": {"get": {"tags": ["Accounts"], "x-rpc-api": "GetWatermarks", "summary": "Get Watermarks (per-account high/low water marks)", "description": "**RPC Function:** `GetWatermarks`", "operationId": "handle_get_watermarks", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/atm-templates": {"get": {"tags": ["General"], "x-rpc-api": "GetAtmTemplates", "summary": "Get All ATM Templates", "description": "**RPC Function:** `GetAtmTemplates`", "operationId": "get_templates", "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts": {"get": {"tags": ["Accounts"], "x-rpc-api": "ListAccounts", "summary": "Get Accounts", "description": "**RPC Function:** `ListAccounts`", "operationId": "accts", "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/positions": {"get": {"tags": ["Positions"], "x-rpc-api": "GetAllPositions", "summary": "Get All Open Positions (Across all accounts)", "description": "**RPC Function:** `GetAllPositions`\n\n**Optional fields (from add-on):** `includeFlat`", "operationId": "get_all_positions", "parameters": [{"name": "includeFlat", "in": "query", "required": false, "schema": {"type": "string", "default": "false"}}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/orders": {"get": {"tags": ["Orders"], "x-rpc-api": "GetAllOrders", "summary": "Get All Orders (Across all accounts)", "description": "**RPC Function:** `GetAllOrders`\n\n**Optional fields (from add-on):** `activeOnly`, `lookbackTime`", "operationId": "get_all_orders", "parameters": [{"name": "activeOnly", "in": "query", "required": false, "schema": {"type": "string", "default": "true"}}, {"name": "lookbackTime", "in": "query", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/executions/order/{orderId}": {"get": {"tags": ["Executions"], "x-rpc-api": "GetExecutionsByOrderId", "summary": "Get Executions by Order ID (matches both current and original/initial order ID)", "description": "**RPC Function:** `GetExecutionsByOrderId`\n\n**Optional fields (from add-on):** `orderId`", "operationId": "get_executions_by_order_id", "parameters": [{"name": "orderId", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Order ID"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/snapshot": {"get": {"tags": ["Accounts"], "x-rpc-api": "GetAccountSummary", "summary": "Get Accounts Summary", "description": "**RPC Function:** `GetAccountSummary`", "operationId": "summary", "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/positions/flatten": {"post": {"tags": ["Positions"], "x-rpc-api": "Flatten", "summary": "Flatten All Positions in All Accounts", "description": "**RPC Function:** `Flatten`\n\n**Optional fields (from add-on):** `account`, `instrument`, `cancelOrders`, `strategyTag`, `strategyTagMode`, `force`", "operationId": "flatten_everything", "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"account": {"type": "string"}, "cancelOrders": {"type": "boolean"}, "force": {"type": "boolean"}, "instrument": {"type": "string"}, "strategyTag": {"type": "string"}, "strategyTagMode": {"type": "string"}}}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}": {"get": {"tags": ["Accounts"], "x-rpc-api": "GetAccount", "summary": "Get Account", "description": "**RPC Function:** `GetAccount`\n\n**Optional fields (from add-on):** `account`", "operationId": "acct", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/orders/cancelall": {"post": {"tags": ["Orders"], "x-rpc-api": "CancelAllOrders", "summary": "Cancel All Orders in All Accounts", "description": "**RPC Function:** `CancelAllOrders`", "operationId": "cancel_all_orders", "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/positions": {"get": {"tags": ["Positions"], "x-rpc-api": "ListPositions", "summary": "List Active Positions in Account", "description": "**RPC Function:** `ListPositions`\n\n**Optional fields (from add-on):** `account`", "operationId": "list_positions", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders": {"get": {"tags": ["Orders"], "x-rpc-api": "ListOrders", "summary": "List Active/Orders in Account", "description": "**RPC Function:** `ListOrders`\n\n**Optional fields (from add-on):** `account`, `lookbackTime`, `activeOnly`", "operationId": "list_orders", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "activeOnly", "in": "query", "required": false, "schema": {"type": "string", "default": "true"}}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/strategies": {"get": {"tags": ["Strategies"], "x-rpc-api": "ListStrategies", "summary": "List Strategies", "description": "**RPC Function:** `ListStrategies`\n\n**Optional fields (from add-on):** `includeTerminal`", "operationId": "list_strats", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "includeTerminal", "in": "query", "required": false, "schema": {"type": "string", "default": "false"}}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/strategies": {"get": {"tags": ["Strategies"], "x-rpc-api": "ListAllStrategies", "summary": "List All Strategies", "description": "**RPC Function:** `ListAllStrategies`\n\n**Optional fields (from add-on):** `includeTerminal`", "operationId": "list_all_strats", "parameters": [{"name": "includeTerminal", "in": "query", "required": false, "schema": {"type": "string", "default": "false"}}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/strategies/{id}": {"get": {"tags": ["Strategies"], "x-rpc-api": "GetStrategy", "summary": "Get Strategy", "description": "**RPC Function:** `GetStrategy`\n\n**Optional fields (from add-on):** `strategyId`", "operationId": "get_strat", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/strategies/{id}/close": {"post": {"tags": ["Strategies"], "x-rpc-api": "CloseStrategy", "summary": "Close Strategy", "description": "**RPC Function:** `CloseStrategy`\n\n**Optional fields (from add-on):** `strategyId`, `signalName`, `strategyTag`, `force`", "operationId": "close_strat", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/strategies/start": {"post": {"tags": ["Strategies"], "x-rpc-api": "StartStrategy", "summary": "Starts a NinjaScript Strategy", "description": "**RPC Function:** `StartStrategy`\n\n**Optional fields (from add-on):** `account`, `strategyClass`, `strategy_class`, `instrument`, `mode`, `periodType`, `period_type`, `period`, `parameters`", "operationId": "start_strat", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"instrument": {"type": "string"}, "mode": {"type": "string"}, "parameters": {"type": "object"}, "period": {"type": "integer"}, "periodType": {"type": "string"}, "period_type": {"type": "string"}, "strategyClass": {"type": "string"}, "strategy_class": {"type": "string"}}}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/strategies/{id}/enable": {"post": {"tags": ["Strategies"], "x-rpc-api": "EnableStrategy", "summary": "Enable Strategy", "description": "**RPC Function:** `EnableStrategy`", "operationId": "enable_strat", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/strategies/{id}/disable": {"post": {"tags": ["Strategies"], "x-rpc-api": "DisableStrategy", "summary": "Disable Strategy", "description": "**RPC Function:** `DisableStrategy`", "operationId": "disable_strat", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/executions": {"get": {"tags": ["Executions"], "x-rpc-api": "ListExecutions", "summary": "Get Executions by Account", "description": "**RPC Function:** `ListExecutions`", "operationId": "list_executions", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "lookbackTime", "in": "query", "required": false, "schema": {"type": "string", "default": "320"}}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/positions/close": {"post": {"tags": ["Positions"], "x-rpc-api": "ClosePosition", "summary": "Close Position (account, instrument)", "description": "**RPC Function:** `ClosePosition`\n\n**Optional fields (from add-on):** `strategyTag`, `force`, `quantity`, `percent`", "operationId": "close_position", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"force": {"type": "boolean"}, "instrument": {"type": "string"}, "percent": {"type": "number"}, "quantity": {"type": "integer"}, "strategyTag": {"type": "string"}}, "required": ["instrument"]}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/positions/reverse": {"post": {"tags": ["Positions"], "x-rpc-api": "Reverse", "summary": "Reverse", "description": "**RPC Function:** `Reverse`\n\n**Optional fields (from add-on):** `strategyTag`, `force`", "operationId": "reverse", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"force": {"type": "boolean"}, "instrument": {"type": "string"}, "strategyTag": {"type": "string"}}, "required": ["instrument"]}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/positions/reverseposition": {"post": {"tags": ["Positions"], "x-rpc-api": "ReversePosition", "summary": "Reverse Position (account, instrument, action, orderType, quantity, timeInForce, limitPrice, stopPrice, ocoId, strategy)", "description": "**RPC Function:** `ReversePosition`\n\n**Optional fields (from add-on):** `quantity`, `account`, `instrument`, `strategyTag`, `force`, `action`", "operationId": "reverse_position", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"action": {"type": "string"}, "force": {"type": "boolean"}, "instrument": {"type": "string"}, "quantity": {"type": "integer"}, "strategyTag": {"type": "string"}}}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/positions/flatten": {"post": {"tags": ["Positions"], "x-rpc-api": "Flatten", "summary": "Flatten Positions in 1 account (account, instrument)", "description": "**RPC Function:** `Flatten`\n\n**Optional fields (from add-on):** `account`, `instrument`, `cancelOrders`, `strategyTag`, `strategyTagMode`, `force`", "operationId": "flatten_position", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"cancelOrders": {"type": "boolean"}, "force": {"type": "boolean"}, "instrument": {"type": "string"}, "strategyTag": {"type": "string"}, "strategyTagMode": {"type": "string"}}}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/position": {"get": {"tags": ["Accounts"], "x-rpc-api": "GetPosition", "summary": "Get Position by Account + Instrument (instrument URL-encoded)", "description": "**RPC Function:** `GetPosition`\n\n**Optional fields (from add-on):** `account`, `instrument`", "operationId": "get_position", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "instrument", "in": "query", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/market/info": {"get": {"tags": ["Market Data"], "x-rpc-api": "MarketInfo", "summary": "Get Market Info", "description": "**RPC Function:** `MarketInfo`\n\n**Optional fields (from add-on):** `instrument`, `root`", "operationId": "get_market_info", "parameters": [{"name": "instrument", "in": "query", "required": true, "schema": {"type": "string"}}, {"name": "root", "in": "query", "required": true, "schema": {"type": "string"}}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/market/quote": {"get": {"tags": ["Market Data"], "x-rpc-api": "GetQuote", "summary": "Get Quote", "description": "**RPC Function:** `GetQuote`\n\n**Optional fields (from add-on):** `instrument`, `root`, `showRollover`", "operationId": "get_quote", "parameters": [{"name": "instrument", "in": "query", "required": true, "schema": {"type": "string"}}, {"name": "root", "in": "query", "required": true, "schema": {"type": "string"}}, {"name": "showRollover", "in": "query", "required": false, "schema": {"type": "string", "default": "false"}}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/quote": {"get": {"tags": ["Accounts"], "x-rpc-api": "GetQuote", "summary": "Get Quote", "description": "**RPC Function:** `GetQuote`\n\n**Optional fields (from add-on):** `instrument`, `root`, `showRollover`", "operationId": "get_quote", "parameters": [{"name": "instrument", "in": "query", "required": true, "schema": {"type": "string"}}, {"name": "root", "in": "query", "required": true, "schema": {"type": "string"}}, {"name": "showRollover", "in": "query", "required": false, "schema": {"type": "string", "default": "false"}}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/market/bars": {"post": {"tags": ["Market Data"], "x-rpc-api": "GetBars", "summary": "Get historical bars", "description": "**RPC Function:** `GetBars`\n\n**Optional fields (from add-on):** `periodType`, `period`, `daysBack`, `from`, `to`, `limit`, `splitAdjust`, `dividendAdjust`, `mergePolicy`", "operationId": "bars", "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"daysBack": {"type": "integer"}, "dividendAdjust": {"type": "boolean"}, "from": {"type": "string"}, "instrument": {"type": "string"}, "limit": {"type": "integer"}, "mergePolicy": {"type": "string"}, "period": {"type": "integer"}, "periodType": {"type": "string"}, "splitAdjust": {"type": "boolean"}, "to": {"type": "string"}}, "required": ["instrument"]}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders/cancel": {"post": {"tags": ["Orders"], "x-rpc-api": "CancelOrders", "summary": "Cancel Orders by Account + Instrument", "description": "**RPC Function:** `CancelOrders`\n\n**Optional fields (from add-on):** `account`, `instrument`, `strategyTag`, `force`", "operationId": "cancel_orders", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"force": {"type": "boolean"}, "instrument": {"type": "string"}, "strategyTag": {"type": "string"}}}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders/place": {"post": {"tags": ["Orders"], "x-rpc-api": "PlaceOrder", "summary": "Place Order", "description": "**RPC Function:** `PlaceOrder`\n\n**Optional fields (from add-on):** `quantity`, `limitPrice`, `stopPrice`, `instrument`, `action`, `orderType`, `targetQuantity`, `ocoId`, `strategy`, `orderId`, `strategyTag`, `force`, `requireMarketPosition`, `maxPositions`, `smartOptions`", "operationId": "place_order", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"action": {"type": "string"}, "force": {"type": "boolean"}, "instrument": {"type": "string"}, "limitPrice": {"type": "number"}, "maxPositions": {"type": "integer"}, "ocoId": {"type": "string"}, "orderId": {"type": "string"}, "orderType": {"type": "string"}, "quantity": {"type": "integer"}, "requireMarketPosition": {"type": "string"}, "smartOptions": {"type": "object"}, "stopPrice": {"type": "number"}, "strategy": {"type": "string"}, "strategyTag": {"type": "string"}, "targetQuantity": {"type": "integer"}, "timeInForce": {"type": "string"}}, "required": ["timeInForce"]}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders/flatplace": {"post": {"tags": ["Orders"], "x-rpc-api": "FlatPlace", "summary": "Flat Place Order", "description": "**RPC Function:** `FlatPlace`\n\n**Optional fields (from add-on):** `quantity`, `limitPrice`, `stopPrice`, `account`, `instrument`, `strategyTag`, `force`, `action`", "operationId": "flat_place_order", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"action": {"type": "string"}, "force": {"type": "boolean"}, "instrument": {"type": "string"}, "limitPrice": {"type": "number"}, "quantity": {"type": "integer"}, "stopPrice": {"type": "number"}, "strategyTag": {"type": "string"}}}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders/{id}/status": {"get": {"tags": ["Orders"], "x-rpc-api": "GetOrderStatus", "summary": "Get Order Status by ID", "description": "**RPC Function:** `GetOrderStatus`", "operationId": "get_order_status", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders/{id}/change": {"put": {"tags": ["Orders"], "x-rpc-api": "Change", "summary": "Change Order", "description": "**RPC Function:** `Change`\n\n**Optional fields (from add-on):** `quantity`, `limitPrice`, `stopPrice`, `strategyId`, `account`, `strategyTag`, `force`", "operationId": "change_order", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"force": {"type": "boolean"}, "limitPrice": {"type": "number"}, "orderId": {"type": "string"}, "quantity": {"type": "integer"}, "stopPrice": {"type": "number"}, "strategyId": {"type": "string"}, "strategyTag": {"type": "string"}}, "required": ["orderId"]}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders/{id}/cancel": {"post": {"tags": ["Orders"], "x-rpc-api": "Cancel", "summary": "Cancel Order by ID", "description": "**RPC Function:** `Cancel`\n\n**Optional fields (from add-on):** `strategyId`, `account`, `strategyTag`, `force`", "operationId": "cancel_order", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders/cancel_and_bracket": {"post": {"tags": ["Orders"], "x-rpc-api": "CancelAndBracket", "summary": "Cancel existing orders and immediately place new OCO Bracket (TP/SL)", "description": "`action` is the direction of the position being protected, not the exit\n    direction. The add-on inverts it: Buy/BuyToCover \u2192 Sell exits;\n    Sell/SellShort \u2192 BuyToCover exits. See post-cancel-and-bracket.mdx.\n\n    {\n      \"api\": \"CancelAndBracket\",\n      \"args\": {\n        \"account\": \"Sim101\",\n        \"instrument\": \"ES 03-26\",\n        \"action\": \"Buy\",\n        \"quantity\": 1,\n        \"takeProfit\": 4550.00,\n        \"stopLoss\": 4450.00,\n        \"ocoId\": \"Protect_Long_001\"\n      }\n    }\n\n**RPC Function:** `CancelAndBracket`\n\n**Optional fields (from add-on):** `takeProfit`, `stopLoss`, `delayMs`, `strategyTag`, `force`, `ocoId`", "operationId": "cancel_and_bracket", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"action": {"type": "string"}, "delayMs": {"type": "integer"}, "force": {"type": "boolean"}, "instrument": {"type": "string"}, "ocoId": {"type": "string"}, "quantity": {"type": "integer"}, "stopLoss": {"type": "number"}, "strategyTag": {"type": "string"}, "takeProfit": {"type": "number"}}, "required": ["action", "instrument", "quantity"]}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders/{id}/replace": {"post": {"tags": ["Orders"], "x-rpc-api": "CancelReplace", "summary": "Cancel Replace Order", "description": "**RPC Function:** `CancelReplace`\n\n**Optional fields (from add-on):** `quantity`, `limitPrice`, `stopPrice`, `strategyTag`, `force`", "operationId": "cancel_replace_order", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "requestBody": {"required": true, "content": {"application/json": {"schema": {"type": "object", "properties": {"action": {"type": "string"}, "force": {"type": "boolean"}, "instrument": {"type": "string"}, "limitPrice": {"type": "number"}, "orderId": {"type": "string"}, "orderType": {"type": "string"}, "quantity": {"type": "integer"}, "stopPrice": {"type": "number"}, "strategyTag": {"type": "string"}, "timeInForce": {"type": "string"}}, "required": ["action", "instrument", "orderId", "orderType", "timeInForce"]}}}}, "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders/{id}": {"get": {"tags": ["Orders"], "x-rpc-api": "GetOrder", "summary": "Get Order by ID", "description": "**RPC Function:** `GetOrder`\n\n**Optional fields (from add-on):** `orderId`", "operationId": "get_order", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/orders/{id}/lifecycle": {"get": {"tags": ["Orders"], "x-rpc-api": "GetOrderLifecycle", "summary": "Get Order Lifecycle (v1.13.2)", "description": "Returns the full lifecycle of one order: every state transition recorded\n    by the addon plus optional fills from NT8's in-memory Executions. Use this\n    to reconcile orders end-to-end when WebSocket events are dropped or arrive\n    out of order.\n\n    Available in CrossTrade XT Add-On v1.13.2 and later. Older addons will\n    return an \"Unknown API command\" error.\n\n    Query string:\n      includeFills (bool, default true)  \u2014 merge fills\n      includeRaw   (bool, default false) \u2014 include raw_json column\n      limit        (int,  default 200)   \u2014 cap rows returned (max 2000)\n\n**RPC Function:** `GetOrderLifecycle`\n\n**Optional fields (from add-on):** `includeRaw`, `limit`", "operationId": "get_order_lifecycle", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}, "/v1/api/accounts/{account}/executions/{id}": {"get": {"tags": ["Executions"], "x-rpc-api": "GetExecution", "summary": "Get Execution by ID", "description": "**RPC Function:** `GetExecution`", "operationId": "get_execution", "parameters": [{"name": "account", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Account name (e.g., \"Sim101\")", "example": "Sim101"}, {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}, "description": "Resource ID"}], "responses": {"200": {"description": "Successful response", "content": {"application/json": {"schema": {"type": "object", "properties": {"success": {"type": "boolean"}, "data": {"type": "object"}}}}}}, "400": {"description": "Bad request or operation error", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "401": {"description": "Authentication failed", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "408": {"description": "Client (NinjaTrader add-on) not connected", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}, "429": {"description": "Rate limit exceeded (180 req/min per user)", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}}, "security": [{"bearerAuth": []}]}}}, "components": {"securitySchemes": {"bearerAuth": {"type": "http", "scheme": "bearer", "description": "API bearer token. Requires an active Pro subscription with API access."}}, "schemas": {"Error": {"type": "object", "properties": {"error": {"type": "string", "description": "Error message"}}}}}, "tags": [{"name": "Accounts", "description": "Account management and queries"}, {"name": "Positions", "description": "Position management \u2014 list, close, flatten, reverse"}, {"name": "Orders", "description": "Order placement, modification, and cancellation"}, {"name": "Strategies", "description": "Strategy management"}, {"name": "Executions", "description": "Execution history and queries"}, {"name": "Market Data", "description": "Quotes, bars, subscriptions, and streaming"}, {"name": "WebSocket API", "description": "Real-time streaming WebSocket API"}]}