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

> Gửi yêu cầu sửa lệnh đã đặt theo `orderId`.

- Với cơ sở, lệnh sửa thành công đồng nghĩa với hủy lệnh cũ và đặt lại lệnh mới, người dùng có thể sửa đồng thời giá và khối lượng.
    
- Với phái sinh, người dùng chỉ có thể sửa hoặc giá hoặc khối lượng. Khối lượng sửa phải lớn hơn khối lượng đã khớp (nếu có).



## OpenAPI

````yaml https://cdn.entrade.com.vn/dnse-openapi/doc/dnse-openapi-2026-07-23.yaml put /accounts/{accountNo}/orders/{orderId}
openapi: 3.0.0
info:
  title: OpenAPI-V2-Spec 260730
  version: 1.0.0
  description: DNSE OpenAPI spec and tests
servers:
  - url: https://openapi-uat.dnse.com.vn
security: []
paths:
  /accounts/{accountNo}/orders/{orderId}:
    parameters:
      - name: accountNo
        in: path
        required: true
        description: Số tiểu khoản
        deprecated: false
        schema:
          type: string
        example: '0001179019'
      - name: orderId
        in: path
        required: true
        description: Mã lệnh giao dịch
        deprecated: false
        schema:
          type: integer
        example: '966'
    put:
      tags:
        - trading
      summary: Sửa lệnh
      description: "Gửi yêu cầu sửa lệnh đã đặt theo\_`orderId`.\n\n- Với cơ sở, lệnh sửa thành công đồng nghĩa với hủy lệnh cũ và đặt lại lệnh mới, người dùng có thể sửa đồng thời giá và khối lượng.\n    \n- Với phái sinh, người dùng chỉ có thể sửa hoặc giá hoặc khối lượng. Khối lượng sửa phải lớn hơn khối lượng đã khớp (nếu có)."
      parameters:
        - name: marketType
          in: query
          required: true
          description: |-
            Loại thị trường 
            - STOCK: Giao dịch cơ sở
            - DERIVATIVE: Giao dịch phái sinh
            - BOND: Giao dịch trái phiếu
          deprecated: false
          schema:
            type: string
          example: DERIVATIVE
        - name: orderCategory
          in: query
          required: true
          description: Phân loại lệnh thường (mặc định NORMAL)
          deprecated: false
          schema:
            type: string
          example: NORMAL
        - name: X-API-Key
          in: header
          required: true
          description: API Key được cấp khi đăng ký dịch vụ
          schema:
            type: string
          example: '{{apiKey}}'
        - name: X-Signature
          in: header
          required: true
          description: Chữ ký xác thực yêu cầu
          schema:
            type: string
          example: '{{signature}}'
        - name: X-Aux-Date
          in: header
          required: true
          description: Thời gian thực hiện yêu cầu
          schema:
            type: string
          example: '{{date}}'
        - name: trading-token
          in: header
          required: true
          description: Token đặt lệnh
          schema:
            type: string
          example: '{{tradingToken}}'
        - name: version
          in: header
          description: API version (YYYY-MM-DD)
          schema:
            type: string
            format: date
          example: '2026-07-23'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                price:
                  type: number
                  example: 1851
                  description: >-
                    Giá mới cho lệnh LO

                    - Đối với lệnh cơ sở, có thể sửa cả giá và khối lượng

                    - Đối với lệnh phái sinh, chỉ được sửa hoặc giá hoặc khối
                    lượng
                  format: double
                quantity:
                  type: integer
                  example: 3
                  description: >-
                    Khối lượng mới

                    - Đối với lệnh phái sinh, khối lượng mới phải lớn hơn khối
                    lượng đã khớp (nếu có) của lệnh đã đặt
                  format: int32
            example:
              price: 1851
              quantity: 3
      responses:
        '200':
          description: OK
          headers:
            Content-Length:
              schema:
                type: integer
              example: 435
            Date:
              schema:
                type: string
              example: Tue, 24 Mar 2026 04:14:21 GMT
            Vary:
              schema:
                type: string
              example: Origin
            X-Ratelimit-Limit:
              schema:
                type: integer
              example: -1
            X-Ratelimit-Remaining:
              schema:
                type: integer
              example: 0
            X-Ratelimit-Reset:
              schema:
                type: integer
              example: 0
            X-Tyk-Api-Expires:
              schema:
                type: string
              example: Thu, 02 Jan 3000 15:04:00 UTC
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    example: 1626
                    description: Id lệnh giao dịch
                    format: int32
                  accountNo:
                    type: string
                    example: '0001179019'
                    description: Số tiểu khoản
                  side:
                    type: string
                    example: NS
                    description: |-
                      Chiều đặt lệnh
                      - NB: Mua
                      - NS: Bán
                  loanPackageId:
                    type: integer
                    example: 2278
                    description: Mã gói vay
                    format: int32
                  symbol:
                    type: string
                    example: 41I1G4000
                    description: Mã chứng khoán
                  orderType:
                    type: string
                    example: LO
                    description: |-
                      Loại lệnh
                      - LO: Lệnh giới hạn
                      - MOK/MAK/MTL: Lệnh thị trường
                      - ATO/ATC: Lệnh phiên định kỳ mở cửa/đóng cửa
                      - PLO: Lệnh khớp lệnh sau giờ
                  orderCategory:
                    type: string
                    example: NORMAL
                    description: Phân loại lệnh thường (mặc định NORMAL)
                  price:
                    type: number
                    example: 1851
                    description: Giá đặt
                    format: double
                  quantity:
                    type: integer
                    format: int32
                    example: 3
                    description: Khối lượng đặt
                  fillQuantity:
                    type: integer
                    example: 0
                    description: Khối lượng khớp
                    format: int32
                  canceledQuantity:
                    type: integer
                    example: 0
                    description: Khối lượng đã hủy
                    format: int32
                  marketType:
                    type: string
                    example: DERIVATIVE
                    description: |-
                      Loại thị trường
                      - STOCK: Lệnh cơ sở
                      - DERIVATIVE: Lệnh phái sinh
                  transDate:
                    type: string
                    example: '2026-03-16'
                    description: Ngày giao dịch
                  createdDate:
                    type: string
                    example: '2026-03-24T04:09:50.761146893Z'
                    description: Thời điểm tạo
                    format: date-time
                  modifiedDate:
                    type: string
                    example: '2026-03-24T04:14:21.004856492Z'
                    description: Thời điểm cập nhật
                    format: date-time
              example:
                id: 1626
                accountNo: '0001179019'
                side: NS
                loanPackageId: 2278
                symbol: 41I1G4000
                orderType: LO
                orderCategory: NORMAL
                price: 1851
                quantity: 3
                fillQuantity: 0
                canceledQuantity: 0
                marketType: DERIVATIVE
                transDate: '2026-03-16'
                createdDate: '2026-03-24T04:09:50.761146893Z'
                modifiedDate: '2026-03-24T04:14:21.004856492Z'
        '400':
          description: Yêu cầu không hợp lệ
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 400
                    description: Mã HTTP
                    format: int32
                  code:
                    type: string
                    example: OA-003
                    description: Mã lỗi
                  message:
                    type: string
                    example: Thông tin nhập không hợp lệ
                    description: Thông điệp lỗi
              example:
                code: OA-003
                message: Thông tin nhập không hợp lệ
                status: 400
        '500':
          description: Lỗi hệ thống
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 500
                    description: Mã HTTP
                    format: int32
                  code:
                    type: string
                    example: OA-009
                    description: Mã lỗi
                  message:
                    type: string
                    example: Lỗi hệ thống
                    description: Thông điệp lỗi
              example:
                code: OA-009
                message: Lỗi hệ thống
                status: 500

````

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