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,\nand to Tradovate\
    \ through your linked Tradovate account.\n\n## Architecture\n\nNinjaTrader endpoints (`/v1/api/*`, excluding `/v1/api/tv/*`)\
    \ require an active NinjaTrader 8\ninstance with the CrossTrade add-on connected. Requests are forwarded via RPC to the\
    \ add-on\nrunning on your machine.\n\nTradovate endpoints (`/v1/api/tv/*`) require a linked Tradovate account (link one\
    \ from the\nTradovate Account Manager in the dashboard). Calls execute server-side against the Tradovate\nWeb API — NinjaTrader\
    \ does not need to be running.\n\n**Access methods:**\n1. **REST API** (this spec) — Standard HTTP endpoints at `/v1/api/*`\
    \ and `/v1/api/tv/*`\n2. **WebSocket API** — Connect to `/ws/stream` for real-time data and RPC (NinjaTrader only;\n \
    \  there is no Tradovate WebSocket surface yet)\n\n## Authentication\n\nAll endpoints require a Bearer token in the `Authorization`\
    \ header.\nAPI access requires a **Pro subscription**. Tradovate endpoints additionally require a linked\nTradovate account.\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 09-26\"]}` |\n| `unsubscribe` | Unsubscribe:\
    \ `{\"action\": \"unsubscribe\", \"instruments\": [\"ES 09-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
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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **Optional fields (from add-on):** `quantity`, `account`, `instrument`, `strategyTag`, `force`'
      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:
                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`


        **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`


        **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`


        **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`


        **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`


        **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`


        **Optional fields (from add-on):** `periodType`, `period`, `daysBack`, `from`, `to`, `limit`, `timeoutMs`, `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
                timeoutMs:
                  type: integer
                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`


        **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`


        **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`


        **Optional fields (from add-on):** `quantity`, `limitPrice`, `stopPrice`, `strategyTag`, `force`'
      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:
                force:
                  type: boolean
                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`


        **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`


        **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 → Sell exits;\n    Sell/SellShort → BuyToCover exits. See post-cancel-and-bracket.mdx.\n\n  \
        \  {\n      \"api\": \"CancelAndBracket\",\n      \"args\": {\n        \"account\": \"Sim101\",\n        \"instrument\"\
        : \"ES 09-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`


        **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`


        **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)  — merge\
        \ fills\n      includeRaw   (bool, default false) — include raw_json column\n      limit        (int,  default 200)\
        \   — 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: []
  /v1/api/tv/status:
    get:
      tags:
      - Tradovate Status
      summary: 'Tradovate link status: identities, environments, token expiry'
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_status
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts:
    get:
      tags:
      - Tradovate Accounts
      summary: List linked Tradovate accounts
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_accounts
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/snapshot:
    get:
      tags:
      - Tradovate Accounts
      summary: 'Live snapshot of every account: balances, open positions with P&L, working orders'
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_snapshot
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}:
    get:
      tags:
      - Tradovate Accounts
      summary: Get one account with its cash-balance snapshot
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_account
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/positions:
    get:
      tags:
      - Tradovate Positions
      summary: All open positions across linked identities
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_positions
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/positions:
    get:
      tags:
      - Tradovate Positions
      summary: Fill-reconciled open positions for one account
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_account_positions
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/position:
    get:
      tags:
      - Tradovate Positions
      summary: Net position for one account and instrument (NT8 GetPosition parity)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_account_position
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      - name: instrument
        in: query
        required: true
        schema:
          type: string
        description: 'Instrument: continuous (''ES1!''), NT8 (''ES 09-26''), or Tradovate (''ESU6'') form'
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/orders:
    get:
      tags:
      - Tradovate Orders
      summary: Every order across linked identities (NT8 all-orders parity)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_all_orders
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders:
    get:
      tags:
      - Tradovate Orders
      summary: Working orders for one account
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_account_orders
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders/{id}:
    get:
      tags:
      - Tradovate Orders
      summary: Get one order by id
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_order_item
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Tradovate numeric order id or user-assigned 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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders/{id}/status:
    get:
      tags:
      - Tradovate Orders
      summary: Slim order status read (NT8 order-status parity)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_order_status
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Tradovate numeric order id or user-assigned 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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders/{id}/lifecycle:
    get:
      tags:
      - Tradovate Orders
      summary: 'Order audit trail: current version, commands, and command reports'
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_order_lifecycle
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Tradovate numeric order id or user-assigned 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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/fills:
    get:
      tags:
      - Tradovate Fills
      summary: All fills across linked identities
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_fills
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/fills:
    get:
      tags:
      - Tradovate Fills
      summary: Fills for the identity that owns one account
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_account_fills
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/fills/order/{orderId}:
    get:
      tags:
      - Tradovate Fills
      summary: Fills for one order (NT8 executions-by-order parity)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_fills_by_order
      parameters:
      - name: orderId
        in: path
        required: true
        schema:
          type: string
        description: Tradovate numeric order id or user-assigned orderId
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/watermarks:
    get:
      tags:
      - Tradovate Accounts
      summary: P&L high-water marks tracked by the Account Manager monitor engine
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_watermarks
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/cashbalances:
    get:
      tags:
      - Tradovate Balances
      summary: Cash-balance rows for every linked identity
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_cashbalances
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/marginsnapshots:
    get:
      tags:
      - Tradovate Balances
      summary: Margin snapshots for every linked identity
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_margins
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/contracts/find:
    get:
      tags:
      - Tradovate Reference
      summary: Find a contract by exact Tradovate symbol
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_contract_find
      parameters:
      - name: name
        in: query
        required: true
        schema:
          type: string
        description: Exact Tradovate contract symbol, e.g. 'ESU6'
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/contracts/suggest:
    get:
      tags:
      - Tradovate Reference
      summary: Contract autocomplete (resolves the active front month)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_contract_suggest
      parameters:
      - name: text
        in: query
        required: true
        schema:
          type: string
        description: Contract root or partial symbol to search
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          minimum: 1
          maximum: 100
          default: 10
        description: Maximum suggestions to return (1-100)
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/exchanges:
    get:
      tags:
      - Tradovate Reference
      summary: Exchange reference list
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).'
      operationId: tv_exchanges
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: array
                    items:
                      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders/place:
    post:
      tags:
      - Tradovate Orders
      x-tv-command: PLACE
      summary: 'Place an order: market/limit/stop types, OCO brackets, inline ATM multibracket'
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `PLACE` — runs through the shared webhook parser and dispatcher (validation, account management locks,
        trade copier fan-out).'
      operationId: tv_place
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instrument: &id011
                  type: string
                  description: 'Instrument: continuous (''ES1!''), NT8 (''ES 09-26''), or Tradovate (''ESU6'') form'
                action: &id012
                  type: string
                  description: buy | sell (long/short accepted)
                  enum:
                  - buy
                  - sell
                  - long
                  - short
                qty: &id001
                  type: integer
                  description: Number of contracts
                orderType: &id002
                  type: string
                  description: market | limit | stop | stoplimit | mit | trailingstop | trailingstoplimit
                  enum:
                  - market
                  - limit
                  - stop
                  - stoplimit
                  - mit
                  - trailingstop
                  - trailingstoplimit
                limitPrice: &id003
                  type: number
                  description: Limit price (limit / stoplimit / mit / trailingstoplimit)
                stopPrice: &id004
                  type: number
                  description: Stop trigger price (stop / stoplimit / trailing types)
                tif: &id005
                  type: string
                  description: day | gtc | ioc | fok | gtd
                  enum:
                  - day
                  - gtc
                  - ioc
                  - fok
                  - gtd
                takeProfit: &id022
                  type: number
                  description: Absolute price for a server-side OCO take-profit leg
                stopLoss: &id023
                  type: number
                  description: Absolute price for a server-side OCO stop-loss leg
                orderId: &id024
                  type: string
                  description: User-assigned order reference for later cancel/change
                text: &id006
                  type: string
                  description: Free-form note attached to the order (max 64 chars)
                  maxLength: 64
                flattenFirst:
                  type: boolean
                  description: Flatten + cancel on the instrument before entering
                requireMarketPosition: &id013
                  type: string
                  description: 'Gate: only act when current position is ''flat'' / ''long'' / ''short'''
                maxPositions: &id014
                  type: integer
                  description: Block entry when N positions already open
                cancelAfter: &id015
                  type: integer
                  description: Minutes (1-180) before an unfilled limit entry auto-cancels
                expireTime: &id007
                  type: string
                  description: ISO-8601 order expiry; required when tif=gtd
                maxShow: &id008
                  type: integer
                  description: Iceberg display quantity
                trailOffset: &id009
                  type: number
                  description: Native trailing-stop distance; required for trailing order types
                pegDifference: &id010
                  type: number
                  description: Alias of trailOffset
                syncStrategy: &id016
                  type: boolean
                  description: Enable Tradovate Strategy Sync for this entry command
                marketPosition: &id017
                  type: string
                  description: 'Remote strategy target side: flat, long, or short'
                prevMarketPosition: &id018
                  type: string
                  description: Remote strategy side before this signal
                outOfSync: &id019
                  type: string
                  description: 'Mismatch policy: wait, flatten, ignore, or resync'
                  enum:
                  - wait
                  - flatten
                  - ignore
                  - resync
                targetQuantity: &id020
                  type: integer
                  description: Exact signed target quantity for resync mode
                strategyExitBlock: &id021
                  type: boolean
                  description: Reject non-opening strategy transitions. Only honored when syncStrategy is enabled
                atmTargets: &id025
                  type: string
                  description: Tradovate-native ATM target offsets, e.g. '40,80' ticks or '10pt,20pt'
                atmStops: &id026
                  type: string
                  description: Tradovate-native ATM stop offsets (required with atm* fields)
                atmQtys: &id027
                  type: string
                  description: Tradovate-native contracts per tier; sums to qty, e.g. '1,1'
                atmTrail: &id028
                  type: string
                  description: Tradovate-native continuous trailing toggle when no trigger is supplied, e.g. 'false,true'
                atmTrailTrigger: &id029
                  type: string
                  description: 'CrossTrade-exclusive: trusted-consensus profit distance that activates a trailing tier, e.g.
                    ''30'' or '',30''. Pair with atmTrailOffset; Day entries only'
                atmTrailOffset: &id030
                  type: string
                  description: 'CrossTrade-managed activation: native Tradovate trail distance after confirmed handoff. Pair
                    with atmTrailTrigger'
                atmBreakeven: &id031
                  type: integer
                  description: 'CrossTrade-exclusive: target tier whose fill moves surviving stops to breakeven; not a native
                    Tradovate AutoBracket field'
                atmBreakevenOffset: &id032
                  type: string
                  description: 'CrossTrade-exclusive: ticks/points past entry for the managed breakeven stop'
              additionalProperties: false
              required:
              - instrument
              - action
              - qty
              - orderType
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders/{id}/cancel:
    post:
      tags:
      - Tradovate Orders
      x-tv-command: CANCEL
      summary: Cancel one working order by id
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `CANCEL` — runs through the shared webhook parser and dispatcher (validation, account management locks,
        trade copier fan-out).'
      operationId: tv_cancel
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Tradovate numeric order id or user-assigned 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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders/{id}/change:
    put:
      tags:
      - Tradovate Orders
      x-tv-command: CHANGE
      summary: Change a working order in place (PUT is canonical for NT8 parity; POST kept for backward compatibility)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `CHANGE` — runs through the shared webhook parser and dispatcher (validation, account management locks,
        trade copier fan-out).'
      operationId: tv_change
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Tradovate numeric order id or user-assigned orderId
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                qty: *id001
                orderType: *id002
                limitPrice: *id003
                stopPrice: *id004
                tif: *id005
                text: *id006
                expireTime: *id007
                maxShow: *id008
                trailOffset: *id009
                pegDifference: *id010
              additionalProperties: 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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders/{id}/replace:
    post:
      tags:
      - Tradovate Orders
      x-tv-command: CANCELREPLACE
      summary: Cancel a working order and place a replacement in one command
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `CANCELREPLACE` — runs through the shared webhook parser and dispatcher (validation, account management
        locks, trade copier fan-out).'
      operationId: tv_replace
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: Tradovate numeric order id or user-assigned orderId
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instrument: *id011
                action: *id012
                qty: *id001
                orderType: *id002
                limitPrice: *id003
                stopPrice: *id004
                tif: *id005
                text: *id006
                expireTime: *id007
                maxShow: *id008
                trailOffset: *id009
                pegDifference: *id010
                requireMarketPosition: *id013
                maxPositions: *id014
                cancelAfter: *id015
                syncStrategy: *id016
                marketPosition: *id017
                prevMarketPosition: *id018
                outOfSync: *id019
                targetQuantity: *id020
                strategyExitBlock: *id021
              additionalProperties: false
              required:
              - instrument
              - action
              - qty
              - orderType
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders/cancel:
    post:
      tags:
      - Tradovate Orders
      x-tv-command: CANCELORDERS
      summary: Cancel every working order on one account
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `CANCELORDERS` — runs through the shared webhook parser and dispatcher (validation, account management
        locks, trade copier fan-out).'
      operationId: tv_cancel_orders
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/orders/cancelall:
    post:
      tags:
      - Tradovate Orders
      x-tv-command: CANCELALLORDERS
      summary: Cancel every working order across all linked identities
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `CANCELALLORDERS` — runs through the shared webhook parser and dispatcher (validation, account management
        locks, trade copier fan-out).'
      operationId: tv_cancel_all
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders/cancel_and_bracket:
    post:
      tags:
      - Tradovate Orders
      x-tv-command: CANCELANDBRACKET
      summary: Cancel working orders on the instrument and attach a fresh OCO bracket (hyphen path = NT8-parity alias)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `CANCELANDBRACKET` — runs through the shared webhook parser and dispatcher (validation, account management
        locks, trade copier fan-out).'
      operationId: tv_cancel_and_bracket
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instrument: *id011
                action: *id012
                qty: *id001
                takeProfit: *id022
                stopLoss: *id023
              additionalProperties: false
              required:
              - instrument
              - action
              - qty
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/orders/flatplace:
    post:
      tags:
      - Tradovate Orders
      x-tv-command: FLATPLACE
      summary: Flatten and cancel on the instrument, then place a fresh entry
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `FLATPLACE` — runs through the shared webhook parser and dispatcher (validation, account management locks,
        trade copier fan-out).'
      operationId: tv_flatplace
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instrument: *id011
                action: *id012
                qty: *id001
                orderType: *id002
                limitPrice: *id003
                stopPrice: *id004
                tif: *id005
                takeProfit: *id022
                stopLoss: *id023
                orderId: *id024
                text: *id006
                requireMarketPosition: *id013
                maxPositions: *id014
                cancelAfter: *id015
                expireTime: *id007
                maxShow: *id008
                trailOffset: *id009
                pegDifference: *id010
                syncStrategy: *id016
                marketPosition: *id017
                prevMarketPosition: *id018
                outOfSync: *id019
                targetQuantity: *id020
                strategyExitBlock: *id021
                atmTargets: *id025
                atmStops: *id026
                atmQtys: *id027
                atmTrail: *id028
                atmTrailTrigger: *id029
                atmTrailOffset: *id030
                atmBreakeven: *id031
                atmBreakevenOffset: *id032
              additionalProperties: false
              required:
              - instrument
              - action
              - qty
              - orderType
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/positions/close:
    post:
      tags:
      - Tradovate Positions
      x-tv-command: CLOSEPOSITION
      summary: Close the position on one account and instrument (partial via qty/percent)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `CLOSEPOSITION` — runs through the shared webhook parser and dispatcher (validation, account management
        locks, trade copier fan-out).'
      operationId: tv_close_position
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instrument: *id011
                qty:
                  type: integer
                  description: Contracts to close (partial close)
                percent:
                  type: number
                  description: Fraction of the position to close, 0-1; qty wins when both set
              additionalProperties: false
              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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/positions/flatten:
    post:
      tags:
      - Tradovate Positions
      x-tv-command: FLATTEN
      summary: Flatten positions on one account (optional instrument / side filters)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `FLATTEN` — runs through the shared webhook parser and dispatcher (validation, account management locks,
        trade copier fan-out).'
      operationId: tv_flatten_account
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instrument: *id011
                marketPosition:
                  type: string
                  description: 'Only flatten this side: ''long'' or ''short'''
                  enum:
                  - long
                  - short
              additionalProperties: 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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/positions/flatten:
    post:
      tags:
      - Tradovate Positions
      x-tv-command: FLATTENEVERYTHING
      summary: Liquidate every position and cancel every working order
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `FLATTENEVERYTHING` — runs through the shared webhook parser and dispatcher (validation, account management
        locks, trade copier fan-out).'
      operationId: tv_flatten_everything
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/positions/reverse:
    post:
      tags:
      - Tradovate Positions
      x-tv-command: REVERSE
      summary: Reverse the live position (liquidate, then opposite entry at same size)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `REVERSE` — runs through the shared webhook parser and dispatcher (validation, account management locks,
        trade copier fan-out).'
      operationId: tv_reverse
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instrument: *id011
              additionalProperties: false
              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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /v1/api/tv/accounts/{account}/positions/reverseposition:
    post:
      tags:
      - Tradovate Positions
      x-tv-command: REVERSEPOSITION
      summary: Flatten the position, then place the specified entry (explicit-size reverse)
      description: '**Tradovate:** requires a linked Tradovate account (no NinjaTrader add-on involved).


        **Command:** `REVERSEPOSITION` — runs through the shared webhook parser and dispatcher (validation, account management
        locks, trade copier fan-out).'
      operationId: tv_reverseposition
      parameters:
      - name: account
        in: path
        required: true
        schema:
          type: string
        description: Account name (e.g., "DEMO12345678")
        example: DEMO12345678
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                instrument: *id011
                action: *id012
                qty: *id001
                orderType: *id002
                limitPrice: *id003
                stopPrice: *id004
                tif: *id005
                takeProfit: *id022
                stopLoss: *id023
                orderId: *id024
                text: *id006
                requireMarketPosition: *id013
                maxPositions: *id014
                cancelAfter: *id015
                expireTime: *id007
                maxShow: *id008
                trailOffset: *id009
                pegDifference: *id010
                syncStrategy: *id016
                marketPosition: *id017
                prevMarketPosition: *id018
                outOfSync: *id019
                targetQuantity: *id020
                strategyExitBlock: *id021
                atmTargets: *id025
                atmStops: *id026
                atmQtys: *id027
                atmTrail: *id028
                atmTrailTrigger: *id029
                atmTrailOffset: *id030
                atmBreakeven: *id031
                atmBreakevenOffset: *id032
              additionalProperties: false
              required:
              - instrument
              - action
              - qty
              - orderType
      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'
        '429':
          description: Rate limit exceeded (180 req/min per user)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: No linked Tradovate account (tradovate_not_linked) or endpoint not available
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
      - bearerAuth: []
  /ws/stream:
    get:
      tags:
      - WebSocket API
      summary: Streaming WebSocket endpoint
      description: "Real-time streaming WebSocket endpoint. Supports:\n\n- **RPC calls** to the NinjaTrader add-on (same functions\
        \ as REST API)\n- **Market data streaming** via instrument subscriptions\n- **PnL streaming** for real-time account\
        \ updates\n\n### Send: RPC Call\n```json\n{\n  \"action\": \"rpc\",\n  \"id\": \"my-request-1\",\n  \"api\": \"PlaceOrder\"\
        ,\n  \"args\": {\n    \"account\": \"Sim101\",\n    \"instrument\": \"ES 09-26\",\n    \"action\": \"Buy\",\n    \"\
        orderType\": \"Market\",\n    \"quantity\": 1,\n    \"timeInForce\": \"Gtc\"\n  }\n}\n```\n\n### Send: Subscribe to\
        \ Market Data\n```json\n{\"action\": \"subscribe\", \"instruments\": [\"ES 09-26\", \"NQ 09-26\"]}\n```\n\n### Send:\
        \ Stream PnL\n```json\n{\"action\": \"streamPnl\", \"enabled\": true, \"interval\": 1000}\n```\n\n### Receive: Market\
        \ Data\n```json\n{\"type\": \"marketData\", \"quotes\": [{\"instrument\": \"ES 09-26\", \"last\": 5425.50, ...}]}\n\
        ```\n\n### Receive: RPC Response\n```json\n{\"id\": \"my-request-1\", \"data\": {\"orderId\": \"abc123\", \"success\"\
        : true}}\n```\n\nSingle session enforced — connecting from a new client disconnects the previous one.\n"
      operationId: websocket_stream
      parameters:
      - name: Authorization
        in: header
        required: true
        schema:
          type: string
        description: Bearer token
      responses:
        '101':
          description: WebSocket upgrade successful
      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 — 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
- name: Tradovate Status
  description: Tradovate link status
- name: Tradovate Accounts
  description: Tradovate accounts, snapshots, and watermarks
- name: Tradovate Positions
  description: Tradovate positions — list, close, flatten, reverse
- name: Tradovate Orders
  description: Tradovate order placement, modification, and cancellation
- name: Tradovate Fills
  description: Tradovate fill history
- name: Tradovate Balances
  description: Tradovate cash balances and margin snapshots
- name: Tradovate Reference
  description: Tradovate contract and exchange reference data
