> ## Documentation Index
> Fetch the complete documentation index at: https://docs.centosfi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Complex Order

> Create a new complex order.

Currently supports conditional orders (TP, SL, STOP). The order is persisted
immediately with `PENDING` status and queued for activation.

**Conditional Order Types:**
- `TP`: Take-profit attached to a parent order. Requires
  `parent_centos_order_id` or `parent_complex_order_id`.
- `SL`: Stop-loss attached to a parent order. Requires
  `parent_centos_order_id` or `parent_complex_order_id`.
- `STOP`: Standalone stop order triggered by market price.

**Response:**
Returns `202 Accepted` with the complex order in `PENDING` status.



## OpenAPI

````yaml /openapi.json post /v1/complex-orders
openapi: 3.1.0
info:
  title: Centos Finance API
  contact:
    name: Centos Finance
    url: https://centosfi.com/
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: https://api.centosfi.com
security: []
tags:
  - name: markets
    description: Search and discover prediction markets across Kalshi and Polymarket.
  - name: subaccounts
    description: >-
      Manage trading subaccounts. Each subaccount can have its own exchange
      credentials and positions.
  - name: positions
    description: View current portfolio positions across all connected exchanges.
  - name: fills
    description: Retrieve trade execution history and fill details.
  - name: prices
    description: Get historical price data and candlesticks from exchanges.
  - name: orders
    description: Place and manage orders on prediction market exchanges.
  - name: complex-orders
    description: >-
      Manage complex orders: conditional orders (take-profit and stop-loss),
      TWAP, and other advanced order types.
paths:
  /v1/complex-orders:
    post:
      tags:
        - complex-orders
      summary: Create Complex Order
      description: >-
        Create a new complex order.


        Currently supports conditional orders (TP, SL, STOP). The order is
        persisted

        immediately with `PENDING` status and queued for activation.


        **Conditional Order Types:**

        - `TP`: Take-profit attached to a parent order. Requires
          `parent_centos_order_id` or `parent_complex_order_id`.
        - `SL`: Stop-loss attached to a parent order. Requires
          `parent_centos_order_id` or `parent_complex_order_id`.
        - `STOP`: Standalone stop order triggered by market price.


        **Response:**

        Returns `202 Accepted` with the complex order in `PENDING` status.
      operationId: create_complex_order_v1_complex_orders_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ComplexOrderCreateRequest'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ComplexOrderCreateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ComplexOrderCreateRequest:
      properties:
        subaccount_id:
          type: string
          format: uuid
          title: Subaccount Id
          description: Subaccount to create the order under
        centos_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Centos Id
          description: Instrument ID. Mutually exclusive with custom_asset_id.
        custom_asset_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Custom Asset Id
          description: Custom asset basket ID. Mutually exclusive with centos_id.
        conditional_order_params:
          anyOf:
            - $ref: '#/components/schemas/ConditionalOrderCreate'
            - type: 'null'
          description: Conditional order parameters
      type: object
      required:
        - subaccount_id
      title: ComplexOrderCreateRequest
      description: Request body for creating a complex order (conditional order).
    ComplexOrderCreateResponse:
      properties:
        complex_order_id:
          type: string
          format: uuid
          title: Complex Order Id
          description: Unique complex order identifier
      type: object
      required:
        - complex_order_id
      title: ComplexOrderCreateResponse
      description: >-
        Schema for a complex order response (unified across all complex order
        types).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ConditionalOrderCreate:
      properties:
        conditional_order_type:
          type: string
          enum:
            - TP
            - SL
            - STOP
            - REVERSE_STOP
          description: 'Type of conditional order: TP (take profit), SL (stop loss), or STOP'
        stop_order_price:
          anyOf:
            - type: number
              exclusiveMaximum: 1
              exclusiveMinimum: 0
            - type: 'null'
          title: Stop Order Price
          description: >-
            Activation price for STOP conditional orders. This is the price at
            which the conditional order triggers and places the trigger_order.
        trigger_order:
          $ref: '#/components/schemas/TriggerOrder'
          description: >-
            The order that gets placed when the conditional order activates. For
            TP/SL this happens after the parent order fills; for STOP this
            happens when stop_order_price is reached.
        parent_centos_order_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Parent Centos Order Id
          description: Parent order ID (required for TP and SL)
        parent_complex_order_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Parent Complex Order Id
          description: Parent complex order ID (for chaining)
      type: object
      required:
        - conditional_order_type
        - trigger_order
      title: ConditionalOrderCreate
      description: >-
        Schema for a conditional order (take profit or stop loss) attached to a
        parent order.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    TriggerOrder:
      properties:
        order_type:
          type: string
          enum:
            - LIMIT
            - MARKET
          description: 'Order type for the triggered order: ''LIMIT'' or ''MARKET'''
        qty:
          type: number
          exclusiveMinimum: 0
          title: Qty
          description: Quantity (number of contracts) for the triggered order
        price:
          anyOf:
            - type: number
              exclusiveMaximum: 1
              exclusiveMinimum: 0
            - type: 'null'
          title: Price
          description: >-
            Limit price for the triggered order (between 0 and 1). Required when
            order_type is LIMIT.
        buy_flag:
          type: boolean
          title: Buy Flag
          description: 'Direction of the triggered order: true=buy, false=sell'
        stop_order_price:
          anyOf:
            - type: number
              exclusiveMaximum: 1
              exclusiveMinimum: 0
            - type: 'null'
          title: Stop Order Price
          description: >-
            Price at which the triggered order activates as a stop or reverse
            stop. Required for SL (stop trigger) and TP MARKET (reverse stop
            trigger). For SL: triggers when price moves against you. For TP
            MARKET: triggers when price moves in your favor.
      type: object
      required:
        - order_type
        - qty
        - buy_flag
      title: TriggerOrder
      description: >-
        The order that will be sent to the exchange when the conditional order's
        condition is met.


        For TP/SL: the parent order fills → the conditional activates → this
        trigger order is placed.

        For STOP/REVERSE_STOP: the stop_order_price is reached → this trigger
        order is placed.

````