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

# Place Order

> Create a new order



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/order/place
openapi: 3.1.0
info:
  title: ekiden-gateway
  description: >-
    API Gateway and WebSocket proxy based on Axum and Utoipa, handling auth,
    rate limiting, and connection buffering.
  license:
    name: ''
  version: 0.1.1
servers:
  - url: https://api.ekiden.fi/
    description: Production
  - url: https://api.staging.ekiden.fi/
    description: Staging
  - url: https://api.dev.ekiden.fi/
    description: Development
  - url: http://localhost:4020/
    description: Local
security: []
paths:
  /api/v1/order/place:
    post:
      tags:
        - Trade
      summary: Place Order
      description: Create a new order
      operationId: place_order
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlaceOrderRequest'
        required: true
      responses:
        '200':
          description: Order placed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlaceOrderResponse'
      security:
        - bearer_auth: []
components:
  schemas:
    PlaceOrderRequest:
      type: object
      description: Request to place an order.
      required:
        - sub_account_address
        - symbol
        - side
        - order_type
        - qty
        - price
        - margin_mode
        - time_in_force
        - post_only
        - reduce_only
        - close_on_trigger
      properties:
        close_on_trigger:
          type: boolean
        expire_time:
          type:
            - string
            - 'null'
          format: date-time
          example: '1672531200000'
        margin_mode:
          $ref: '#/components/schemas/MarginMode'
        order_link_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OrderLinkId'
        order_type:
          $ref: '#/components/schemas/OrderType'
        post_only:
          type: boolean
        price:
          type: string
        qty:
          type: string
        reduce_only:
          type: boolean
        side:
          $ref: '#/components/schemas/Side'
        slippage_tolerance:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SlippageTolerance'
        smp_group:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            Self-match prevention group id. Orders with the same `(user_id,
            smp_group)` are eligible

            for SMP checks.
          minimum: 0
        smp_type:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SmpType'
              description: >-
                Self-match prevention (SMP/STP) strategy. If unset, SMP is
                disabled.
        sub_account_address:
          type: string
        symbol:
          $ref: '#/components/schemas/Symbol'
        time_in_force:
          $ref: '#/components/schemas/TimeInForce'
        tpsl:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TpSl'
        trigger:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/ConditionalOrder'
    PlaceOrderResponse:
      type: object
      description: Response for placing an order.
      required:
        - order_id
      properties:
        order_id:
          $ref: '#/components/schemas/OrderId'
        order_link_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OrderLinkId'
    MarginMode:
      type: string
      enum:
        - Cross
        - Isolated
    OrderLinkId:
      type: string
    OrderType:
      type: string
      description: 'Order type: Limit, Market.'
      enum:
        - Limit
        - Market
    Side:
      type: string
      description: 'Order side: buy or sell.'
      enum:
        - Sell
        - Buy
    SlippageTolerance:
      oneOf:
        - type: object
          required:
            - tick_size
          properties:
            tick_size:
              type: integer
              format: int64
              minimum: 0
        - type: object
          required:
            - percent
          properties:
            percent:
              type: number
              format: double
    SmpType:
      type: string
      description: Self Match Prevention strategy.
      enum:
        - CancelMaker
        - CancelTaker
        - CancelBoth
    Symbol:
      type: string
      example: BTCUSDC
    TimeInForce:
      oneOf:
        - type: string
          description: Good Till Cancel
          enum:
            - GTC
        - type: string
          description: Immediate or Cancel
          enum:
            - IOC
        - type: string
          description: Fill or Kill
          enum:
            - FOK
        - type: object
          description: Good Till Date
          required:
            - GTD
          properties:
            GTD:
              type: integer
              format: int64
              description: Good Till Date
              minimum: 0
        - type: string
          description: Good For Day
          enum:
            - Day
      description: Time in Force instructions.
    TpSl:
      type: object
      required:
        - mode
      properties:
        mode:
          $ref: '#/components/schemas/TpSlMode'
        stop_loss:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TpSlSpec'
        take_profit:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/TpSlSpec'
    ConditionalOrder:
      type: object
      required:
        - trigger_price
        - trigger_direction
        - trigger_by
      properties:
        trigger_by:
          $ref: '#/components/schemas/TriggerBy'
          description: Last Price, Mark Price, or Index Price.
        trigger_direction:
          $ref: '#/components/schemas/TriggerDirection'
          description: Up or Down.
        trigger_price:
          type: string
          description: The price level that activates the order.
    OrderId:
      type: string
      format: uuid
    TpSlMode:
      type: string
      enum:
        - Full
        - Partial
    TpSlSpec:
      oneOf:
        - type: object
          required:
            - market
          properties:
            market:
              type: object
              required:
                - trigger_price
                - trigger_by
              properties:
                trigger_by:
                  $ref: '#/components/schemas/TriggerBy'
                trigger_price:
                  type: string
        - type: object
          required:
            - limit
          properties:
            limit:
              type: object
              required:
                - trigger_price
                - limit_price
                - trigger_by
              properties:
                limit_price:
                  type: string
                trigger_by:
                  $ref: '#/components/schemas/TriggerBy'
                trigger_price:
                  type: string
    TriggerBy:
      type: string
      enum:
        - LastPrice
        - IndexPrice
        - MarkPrice
    TriggerDirection:
      type: string
      enum:
        - Up
        - Down
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````