> ## 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.

# Sửa lệnh

> Sửa lệnh hiện có.



## OpenAPI

````yaml /vi/openapi/ssi.openapi.yaml put /api/v3/trading/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/order:
    put:
      tags:
        - trading
      summary: Sửa lệnh
      description: Sửa lệnh hiện có.
      operationId: modifyOrder
      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/ModifyOrderRequest'
      responses:
        '200':
          description: Thành công.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '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:
    ModifyOrderRequest:
      type: object
      required:
        - accountNo
        - deviceId
      properties:
        clientModifyId:
          description: >-
            Định danh sửa 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 sửa lệnh cho khách hàng và trả về
            response & streaming.
          type:
            - string
            - 'null'
        clientRequestId:
          description: >-
            Định danh lệnh gốc do client tạo ra khi đặt lệnh. Khi để trống thì
            hệ thống sẽ không đối chiếu dựa trên định danh lệnh gốc mà sẽ dựa
            vào `orderId` để xác định lệnh cần sửa.
          type:
            - string
            - 'null'
        orderId:
          description: Định danh lệnh gốc sinh ra bởi hệ thống SSI.
          type:
            - string
            - 'null'
        accountNo:
          description: Số tài khoản giao dịch.
          type: string
        symbol:
          description: Mã chứng khoán.
          type:
            - string
            - 'null'
        side:
          description: Chiều mua hoặc bán của lệnh giao dịch. (B- Buy/Mua, S- Sell/Bán)
          type:
            - string
            - 'null'
          enum:
            - B
            - S
        orderType:
          description: >-
            Loại lệnh giao dịch. (LO - Limit Order/Lệnh giới hạn, ATO - At The
            Open/Lệnh mở cửa, ATC - At The Close/Lệnh đóng cửa, MP - Market
            Price/Giá thị trường)
          type:
            - string
            - 'null'
          enum:
            - LO
            - ATO
            - ATC
            - MP
        price:
          description: >-
            Giá thay đổi của lệnh. Trường này có thể không bắt buộc tùy theo
            loại lệnh và quy định sửa lệnh của sàn giao dịch. Ví dụ, đối với
            lệnh MP (Market Price), giá có thể không cần cung cấp khi sửa lệnh.
          type:
            - string
            - 'null'
        quantity:
          description: >-
            Khối lượng thay đổi của lệnh. Trường này có thể không bắt buộc tùy
            theo quy định sửa lệnh của sàn giao dịch. Ví dụ, một số sàn có thể
            chỉ cho phép sửa giá mà không cho phép sửa khối lượng, hoặc ngược
            lại.
          type:
            - number
            - 'null'
        deviceId:
          description: >-
            Định danh thiết bị thực hiện gửi yêu cầu sửa lệnh. 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'
        ipAddress:
          description: Địa chỉ IP của thiết bị gửi yêu cầu.
          type:
            - string
            - 'null'
    OrderResponse:
      type: object
      properties:
        clientRequestId:
          description: Định danh yêu cầu do client tạo.
          type: string
        orderId:
          description: Định danh lệnh do SSI tạo.
          type: string
        orderStatus:
          description: Trạng thái lệnh.
          type: string
        clientModifyId:
          description: Định danh yêu cầu sửa lệnh do client tạo.
          type: string
        clientCancelId:
          description: Định danh yêu cầu hủy lệnh do client tạo.
          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.