> ## 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ổ lệnh

> Lấy sổ lệnh giao dịch theo từng loại lệnh tương ứng thị trường cơ sở, phái sinh hay trái phiếu, bao gồm trạng thái và thông tin xử lý của từng lệnh.

- Cơ sở (STOCK): lệnh thường (NORMAL), lệnh dừng có điều kiện (STOP)
    
- Phái sinh (DERIVATIVE): lệnh thường (NORMAL), lệnh dừng có điều kiện (STOP), lệnh OCO (OCO)
    
- Trái phiếu (BOND): lệnh thường (NORMAL)



## OpenAPI

````yaml https://cdn.entrade.com.vn/dnse-openapi/doc/dnse-openapi-2026-07-23.yaml get /accounts/{accountNo}/orders
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:
    parameters:
      - name: accountNo
        in: path
        required: true
        description: Số tiểu khoản
        schema:
          type: string
        example: '0001179019'
    get:
      tags:
        - account
      summary: Sổ lệnh
      description: >-
        Lấy sổ lệnh giao dịch theo từng loại lệnh tương ứng thị trường cơ sở,
        phái sinh hay trái phiếu, bao gồm trạng thái và thông tin xử lý của từng
        lệnh.


        - Cơ sở (STOCK): lệnh thường (NORMAL), lệnh dừng có điều kiện (STOP)
            
        - Phái sinh (DERIVATIVE): lệnh thường (NORMAL), lệnh dừng có điều kiện
        (STOP), lệnh OCO (OCO)
            
        - Trái phiếu (BOND): lệnh thường (NORMAL)
      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: STOCK
        - name: orderCategory
          in: query
          required: true
          description: |-
            Phân loại lệnh 
            - NORMAL: lệnh thường  (cơ sở, phái sinh, trái phiếu)
            - STOP: lệnh dừng có điều kiện (cơ sở, phái sinh)
            - OCO: lệnh OCO (phái sinh)
          deprecated: false
          schema:
            type: string
          example: NORMAL
        - name: pageIndex
          in: query
          required: true
          description: 'Kích thước trang dữ liệu '
          schema:
            type: integer
          example: 0
        - name: pageSize
          in: query
          required: true
          description: Số bản ghi trên mỗi trang
          schema:
            type: integer
          example: 10
        - 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-Aux-Date
          in: header
          required: true
          description: Thời gian thực hiện yêu cầu
          schema:
            type: string
          example: '{{date}}'
        - name: X-Signature
          in: header
          required: true
          description: Chữ ký xác thực yêu cầu
          schema:
            type: string
          example: '{{signature}}'
        - name: version
          in: header
          required: false
          description: API version (YYYY-MM-DD)
          deprecated: false
          schema:
            type: string
            format: date
          example: '2026-07-23'
      responses:
        '200':
          description: OK
          headers:
            Content-Length:
              schema:
                type: integer
              example: 641
            Date:
              schema:
                type: string
              example: Tue, 24 Mar 2026 03:32:29 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:
                  orders:
                    type: array
                    example:
                      - id: 141
                        side: NB
                        accountNo: '0001179019'
                        symbol: BCM
                        price: 51200
                        priceSecure: 51200
                        averagePrice: 0
                        quantity: 300
                        fillQuantity: 0
                        canceledQuantity: 0
                        leaveQuantity: 300
                        orderType: LO
                        orderCategory: NORMAL
                        orderStatus: New
                        loanPackageId: 7937
                        marketType: STOCK
                        transDate: '2026-03-16'
                        createdDate: '2026-03-24T03:15:22.226297778Z'
                        modifiedDate: '2026-03-24T03:15:22.358568266Z'
                    description: Danh sách lệnh giao dịch
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 141
                          description: Id lệnh giao dịch
                          format: int32
                        side:
                          type: string
                          example: NB
                          description: |-
                            Chiều giao dịch
                            NB: Mua
                            NS: Bán
                        accountNo:
                          type: string
                          example: '0001179019'
                          description: Số tiểu khoản
                        symbol:
                          type: string
                          example: BCM
                          description: Mã chứng khoán
                        price:
                          type: number
                          example: 51200
                          description: Giá đặt
                          format: double
                        priceSecure:
                          type: number
                          example: 51200
                          description: Giá dùng để kiểm tra sức mua/đặt lệnh
                          format: double
                        averagePrice:
                          type: number
                          example: 0
                          description: Giá khớp trung bình
                          format: double
                        quantity:
                          type: integer
                          example: 300
                          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: 300
                          description: Khối lượng còn lại
                          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ờ
                        orderCategory:
                          type: string
                          example: NORMAL
                          description: >-
                            Phân loại lệnh 

                            - NORMAL: lệnh thường  (cơ sở, phái sinh, trái
                            phiếu)

                            - STOP: lệnh dừng có điều kiện (cơ sở, phái sinh)

                            - OCO: lệnh OCO (phái sinh)
                        orderStatus:
                          type: string
                          example: New
                          description: |-
                            Trạng thái lệnh NORMAL:

                              - Pending/PendingNew: Chờ gửi

                              - New: Chờ khớp

                              - PendingReplace: Chờ sửa

                              - PendingCancel: Chờ hủy

                              - 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: Lệnh được giải tỏa do không khớp trong phiên

                            Trạng thái lệnh STOP/OCO:

                              - New: Chờ kích hoạt                              
                              - Activated: Đã kích hoạt
                              - Cancelled: Đã hủy
                              - Expired: Hết hiệu lực
                              - Rejected: Bị từ chối
                              - Failed: Lệnh thất bại
                        loanPackageId:
                          type: integer
                          example: 7937
                          description: Gói vay áp dụng cho mã chứng khoán
                          format: int32
                        marketType:
                          type: string
                          example: STOCK
                          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-24T03:15:22.226297778Z'
                          description: Thời điểm tạo
                          format: date-time
                        modifiedDate:
                          type: string
                          example: '2026-03-24T03:15:22.358568266Z'
                          description: Thời điểm cập nhật
                          format: date-time
              examples:
                NORMAL - STOCK:
                  value:
                    orders:
                      - id: 141
                        side: NB
                        accountNo: '0001179019'
                        symbol: BCM
                        price: 51200
                        priceSecure: 51200
                        averagePrice: 0
                        quantity: 300
                        fillQuantity: 0
                        canceledQuantity: 0
                        leaveQuantity: 300
                        orderType: LO
                        orderCategory: NORMAL
                        orderStatus: New
                        loanPackageId: 7937
                        marketType: STOCK
                        transDate: '2026-03-16'
                        createdDate: '2026-03-24T03:15:22.226297778Z'
                        modifiedDate: '2026-03-24T03:15:22.358568266Z'
                    pageIndex: 0
                    pageSize: 10
                    totalPages: 1
                    totalRecords: 1
                NORMAL - DERIVATIVE:
                  value:
                    orders:
                      - id: 2286
                        side: NB
                        accountNo: '0001179019'
                        symbol: 41I1G9000
                        price: 1990
                        priceSecure: 1990
                        averagePrice: 0
                        quantity: 3
                        fillQuantity: 0
                        canceledQuantity: 0
                        leaveQuantity: 3
                        orderType: LO
                        orderCategory: NORMAL
                        orderStatus: New
                        loanPackageId: 2278
                        marketType: DERIVATIVE
                        transDate: '2026-07-31'
                        createdDate: '2026-07-31T03:15:22.226297778Z'
                        modifiedDate: '2026-07-31T03:15:22.358568266Z'
                    pageIndex: 0
                    pageSize: 10
                    totalPages: 1
                    totalRecords: 1
                STOP - DERIVATIVE:
                  value:
                    orders:
                      - accountNo: '0001179019'
                        conditionOperator: '>='
                        createdDate: '2026-07-30T15:07:17.616863Z'
                        durationDateTime: '2026-08-20T07:30:00Z'
                        durationType: GTD
                        id: d9lmh9fqs0csemaoe8tg
                        loanPackageId: 1306
                        marketType: DERIVATIVE
                        modifiedDate: '2026-07-30T15:07:17.616863Z'
                        orderCategory: STOP
                        orderStatus: New
                        orderType: LO
                        price: 1900
                        quantity: 3
                        side: NS
                        stopPrice: 1700
                        symbol: 41I1G8000
                      - accountNo: '0001179019'
                        conditionOperator: '>='
                        createdDate: '2026-07-30T10:43:31.246312Z'
                        durationDateTime: '2026-07-31T07:30:00Z'
                        durationType: GTD
                        id: d9lilkvqs0csemaodq3g
                        loanPackageId: 1306
                        marketType: DERIVATIVE
                        modifiedDate: '2026-07-30T10:43:31.246312Z'
                        orderCategory: STOP
                        orderStatus: New
                        orderType: LO
                        price: 1980.5
                        quantity: 1
                        side: NB
                        stopPrice: 2000
                        symbol: 41I1G8000
                    pageIndex: 0
                    pageSize: 2
                    totalPages: 4
                    totalRecords: 8
                OCO - DERIVATIVE:
                  value:
                    orders:
                      - accountNo: '0001179019'
                        createdDate: '2026-07-22T07:41:30.357676Z'
                        durationType: DAY
                        id: d9g78ahqn51s72sdntt0
                        loanPackageId: 2278
                        marketType: DERIVATIVE
                        modifiedDate: '2026-07-22T07:41:30.427436Z'
                        orderCategory: OCO
                        orderStatus: Expired
                        orderType: LO
                        price: 1990
                        quantity: 3
                        side: NB
                        stopOrderPrice: 2005
                        stopPrice: 2000
                        symbol: 41I1G8000
                    pageIndex: 0
                    pageSize: 10
                    totalPages: 1
                    totalRecords: 1
        '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.