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

# Đặt lệnh điều kiện

> Đặt lệnh điều kiện mới. Hỗ trợ các loại lệnh điều kiện bao gồm stop, stop_limit, gtd, bullbear, oco, trailing_stop, trailing_stop_limit.



## OpenAPI

````yaml /vi/openapi/ssi.2026-08-21.openapi.yaml post /api/v3/trading/fco/order
openapi: 3.1.2
info:
  title: SSI FastConnect Open API
  version: 3.0.0
servers:
  - url: https://api.ssi.com.vn
    description: Production
security:
  - SsiBearerAuth: []
tags:
  - name: authentication
    description: Xác thực và quản lý token.
    x-group: Xác thực
  - name: account
    description: Thông tin tài khoản giao dịch.
    x-group: Tài khoản
  - name: market-data
    description: Dữ liệu thị trường.
    x-group: Dữ liệu thị trường
  - name: trading
    description: Giao dịch và quản lý lệnh.
    x-group: Giao dịch
  - name: conditional-orders
    description: Lệnh điều kiện.
    x-group: Lệnh điều kiện
paths:
  /api/v3/trading/fco/order:
    post:
      tags:
        - conditional-orders
      summary: Đặt lệnh điều kiện
      description: >-
        Đặt lệnh điều kiện mới. Hỗ trợ các loại lệnh điều kiện bao gồm stop,
        stop_limit, gtd, bullbear, oco, trailing_stop, trailing_stop_limit.
      operationId: placeConditionalOrder
      parameters:
        - $ref: '#/components/parameters/ContentType'
        - $ref: '#/components/parameters/UserAgent'
        - $ref: '#/components/parameters/AcceptLanguage'
        - $ref: '#/components/parameters/XSignature'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlaceFcoOrderRequest'
      responses:
        '200':
          description: Thành công.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FcoOrderResponse'
              example:
                fcoId: 2e667ae3-934a-4548-be9a-de983a29fe5b
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - SsiBearerAuth: []
components:
  parameters:
    ContentType:
      name: Content-Type
      in: header
      required: true
      description: Định dạng nội dung request body. Chủ yếu là application/json.
      schema:
        type: string
        default: application/json
    UserAgent:
      name: User-Agent
      in: header
      required: false
      description: Thông tin client gửi request.
      schema:
        type: string
    AcceptLanguage:
      name: Accept-Language
      in: header
      required: false
      description: >-
        Ngôn ngữ phản hồi mong muốn. Nếu không có header này, hệ thống sẽ mặc
        định là en
      schema:
        type: string
        default: en
    XSignature:
      name: X-Signature
      in: header
      required: true
      description: >-
        Chữ ký RSA + SHA256 để xác thực tính toàn vẹn của request. Input bao gồm
        SecretKey + JSON body.
      schema:
        type: string
        example: sha256=abc123...
  schemas:
    PlaceFcoOrderRequest:
      type: object
      required:
        - accountNo
        - symbol
        - side
        - type
        - price
        - quantity
        - deviceId
      properties:
        accountNo:
          description: Tài khoản đặt lệnh (tài khoản cơ sở hoặc phái sinh).
          type: string
        deviceId:
          description: >-
            Định danh thiết bị thực hiện gửi yêu cầu. Thông thường dùng MAC
            address hoặc IMEI của thiết bị.
          type: string
        userAgent:
          description: Thông tin về trình duyệt hoặc ứng dụng gửi yêu cầu.
          type:
            - string
            - 'null'
        clientRequestId:
          description: >-
            Định danh lệnh do client tạo ra, dùng để đối chiếu trong các phản
            hồi sau này. Trường này không bắt buộc nhưng nếu có thì nên đảm bảo
            tính duy nhất để tránh nhầm lẫn khi xử lý phản hồi. Khi để trống thì
            hệ thống sẽ tự sinh định danh lệnh cho khách hàng và trả về response
            & streaming.
          type:
            - string
            - 'null'
        ipAddress:
          description: Địa chỉ IP của thiết bị gửi yêu cầu.
          type:
            - string
            - 'null'
        from:
          description: >-
            Ngày bắt đầu hiệu lực của lệnh điều kiện, định dạng `YYYY/MM/DD
            hh:mm:ss`. Mặc định là thời điểm tạo lệnh.
          type:
            - string
            - 'null'
        to:
          description: >-
            Ngày kết thúc hiệu lực của lệnh điều kiện, định dạng `YYYY/MM/DD
            hh:mm:ss`. Mặc định là 24h kể từ thời điểm tạo, tối đa 31 ngày kể từ
            ngày bắt đầu.
          type:
            - string
            - 'null'
        code:
          description: >-
            Mã xác thực OTP hoặc mã PIN dùng để xác thực giao dịch (cần điền nếu
            token chưa được xác thực kèm với OTP)
          type:
            - string
            - 'null'
        symbol:
          description: Mã chứng khoán hoặc mã hợp đồng phái sinh cần đặt lệnh điều kiện.
          type:
            - string
            - 'null'
        side:
          description: Chiều mua hoặc bán của lệnh. B (Buy/Mua) hoặc S (Sell/Bán).
          type:
            - string
            - 'null'
          enum:
            - B
            - S
        type:
          description: Loại lệnh điều kiện.
          type: string
          enum:
            - stop
            - stop_limit
            - gtd
            - bullbear
            - oco
            - trailing_stop
            - trailing_stop_limit
        price:
          description: Giá đặt lệnh. Hỗ trợ giá số hoặc loại lệnh đặc biệt (MP, MOK, MTL).
          type:
            - string
            - 'null'
        quantity:
          description: Khối lượng muốn đặt lệnh.
          type: integer
        priceSlip:
          description: Khoảng trượt giá (price slippage) cho phép khi thực hiện lệnh.
          type:
            - number
            - 'null'
        stopPrice:
          description: >-
            Giá dừng lỗ. Khi giá thị trường đạt đến mức này, lệnh sẽ được kích
            hoạt.
          type:
            - number
            - 'null'
        activePrice:
          description: Giá kích hoạt ban đầu của lệnh điều kiện.
          type:
            - number
            - 'null'
        trailingAmount:
          description: >-
            Khoảng giá trailing. Dùng cho loại lệnh trailing_stop và
            trailing_stop_limit.
          type:
            - number
            - 'null'
        tpActivePrice:
          description: >-
            Giá kích hoạt lệnh chốt lời (Take Profit). Khi giá thị trường đạt
            đến mức này, lệnh chốt lời sẽ được kích hoạt.
          type:
            - number
            - 'null'
        slActivePrice:
          description: >-
            Giá kích hoạt lệnh dừng lỗ (Stop Loss). Khi giá thị trường đạt đến
            mức này, lệnh dừng lỗ sẽ được kích hoạt.
          type:
            - number
            - 'null'
        tpPrice:
          description: Giá chốt lời. Hỗ trợ giá số hoặc loại lệnh đặc biệt (MP, MOK, MTL).
          type:
            - string
            - 'null'
        slPrice:
          description: Giá dừng lỗ. Hỗ trợ giá số hoặc loại lệnh đặc biệt (MP, MOK, MTL).
          type:
            - string
            - 'null'
        tpSlip:
          description: Biên trượt giá chốt lời.
          type:
            - number
            - 'null'
        slSlip:
          description: Biên trượt giá dừng lỗ.
          type:
            - number
            - 'null'
        operator:
          description: Toán tử so sánh giá để kích hoạt lệnh điều kiện.
          type:
            - string
            - 'null'
    FcoOrderResponse:
      type: object
      properties:
        fcoId:
          description: ID của lệnh điều kiện.
          type: string
        username:
          description: Tên người dùng tại SSI.
          type: string
    ErrorResponse:
      type: object
      properties:
        code:
          description: Mã kết quả hoặc mã xác thực giao dịch.
          type: string
        msg:
          description: Thông báo kết quả xử lý.
          type: string
  responses:
    BadRequest:
      description: Yêu cầu không hợp lệ.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Chưa được xác thực hoặc token không hợp lệ.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Lỗi nội bộ máy chủ.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    SsiBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Access token lấy từ endpoint /api/v3/auth/token hoặc
        /api/v3/auth/refresh.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.