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

> Gửi yêu cầu đặt lệnh giao dịch cơ sở hoặc phái sinh trên tài khoản.



## OpenAPI

````yaml https://cdn.entrade.com.vn/dnse-openapi/doc/dnse-openapi-2026-05-07.yaml post /accounts/orders
openapi: 3.0.0
info:
  title: DNSE-OpenAPI-V2
  version: 1.0.0
  description: DNSE OpenAPI spec and tests
servers:
  - url: https://openapi-uat.dnse.com.vn
security: []
paths:
  /accounts/orders:
    post:
      tags:
        - trading
      summary: Đặt lệnh
      description: Gửi yêu cầu đặt lệnh giao dịch cơ sở hoặc phái sinh trên tài khoản.
      parameters:
        - name: marketType
          in: query
          required: true
          description: |-
            Loại thị trường 
            - STOCK: Đặt lệnh cơ sở
            - DERIVATIVE: Đặt lệnh phái sinh
          deprecated: false
          schema:
            type: string
          example: DERIVATIVE
        - name: orderCategory
          in: query
          required: true
          description: Phân loại lệnh thường, lệnh điều kiện (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ụ
          deprecated: false
          schema:
            type: string
          example: '{{apiKey}}'
        - name: X-Signature
          in: header
          required: true
          description: Chữ ký xác thực yêu cầu
          deprecated: false
          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
          deprecated: false
          schema:
            type: string
          example: '{{date}}'
        - name: trading-token
          in: header
          required: true
          description: Token đặt lệnh
          deprecated: false
          schema:
            type: string
          example: '{{tradingToken}}'
        - name: version
          in: header
          description: 'Phiên bản API '
          schema:
            type: string
            format: date
          example: '2026-05-07'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                accountNo:
                  type: string
                  example: '0001179019'
                  description: Số tiểu khoản
                loanPackageId:
                  type: integer
                  example: 2278
                  description: Id gói vay
                  format: int32
                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ờ
                price:
                  type: number
                  example: 35000
                  description: Giá đặt lệnh
                  format: double
                quantity:
                  type: integer
                  example: 300
                  description: Khối lượng đặt lệnh
                  format: int32
                side:
                  type: string
                  example: NB
                  description: |-
                    Loại lệnh
                    - NB: Mua
                    - NS: Bán
                symbol:
                  type: string
                  example: TCB
                  description: Mã chứng khoán
            example:
              accountNo: '0001179019'
              loanPackageId: 2278
              orderType: LO
              price: 1861.5
              quantity: 3
              side: NS
              symbol: 41I1G4000
      responses:
        '200':
          description: OK
          headers:
            Content-Length:
              schema:
                type: integer
              example: 487
            Date:
              schema:
                type: string
              example: Tue, 24 Mar 2026 04:09:50 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
                  symbol:
                    type: string
                    example: 41I1G4000
                    description: Mã chứng khoán
                  side:
                    type: string
                    example: NS
                    description: |-
                      Chiều đặt lệnh
                      NB: Mua
                      NS: Bá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ờ
                  orderStatus:
                    type: string
                    example: Pending
                    description: |-
                      Trạng thái lệnh
                      - PendingNew: Chờ gửi
                      - New: Chờ khớp
                      - PendingReplace: Chờ sửa
                      - PartiallyFilled: Khớp một phần
                      - Filled: Khớp toàn bộ
                      - Canceled: Đã hủy
                      - Rejected: Bị từ chối
                      - Expired: Hết hạn trong phiên
                      - DoneForDay: Giải tỏa trong phiên
                  price:
                    type: number
                    example: 1861.5
                    description: Giá đặt
                    format: double
                  averagePrice:
                    type: integer
                    example: 0
                    description: Giá khớp trung bình
                    format: int32
                  quantity:
                    type: integer
                    example: 3
                    description: Khối lượng đặt
                    format: int32
                  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
                  leaveQuantity:
                    type: integer
                    example: 3
                    description: Khối lượng còn lại
                    format: int32
                  accountNo:
                    type: string
                    example: '0001179019'
                    description: Số tiểu khoản
                  marketType:
                    type: string
                    example: DERIVATIVE
                    description: |-
                      Loại thị trường
                      - STOCK: Lệnh cơ sở
                      - DERIVATIVE: Lệnh phái sinh
                  orderCategory:
                    type: string
                    example: NORMAL
                    description: Phân loại lệnh thường (mặc định NORMAL)
                  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:09:50.761151529Z'
                    description: Thời điểm cập nhật
                    format: date-time
              example:
                id: 1626
                symbol: 41I1G4000
                side: NS
                orderType: LO
                orderStatus: Pending
                price: 1861.5
                averagePrice: 0
                quantity: 3
                fillQuantity: 0
                canceledQuantity: 0
                leaveQuantity: 3
                accountNo: '0001179019'
                marketType: DERIVATIVE
                orderCategory: NORMAL
                transDate: '2026-03-16'
                createdDate: '2026-03-24T04:09:50.761146893Z'
                modifiedDate: '2026-03-24T04:09:50.761151529Z'
        '400':
          description: Yêu cầu không hợp lệ
          headers:
            Content-Length:
              schema:
                type: integer
              example: 86
            Date:
              schema:
                type: string
              example: Wed, 25 Mar 2026 15:28:31 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:
                  status:
                    type: integer
                    example: 400
                    description: Mã HTTP
                    format: int32
                  code:
                    type: string
                    example: STOCK_PRICE_UNDEFINED
                    description: Mã lỗi
                  message:
                    type: string
                    example: Cannot determine stock price
                    description: Thông điệp lỗi
              example:
                status: 400
                code: STOCK_PRICE_UNDEFINED
                message: Cannot determine stock price
        '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.