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

# Lấy sổ lệnh

> Lấy sổ lệnh (Order Book) của Phái Sinh.



## OpenAPI

````yaml /vi/openapi/entrade-v1.yaml get /derivative/orders
openapi: 3.1.0
info:
  title: Entrade Open API
  version: 1.0.0
  description: Đặc tả được trích xuất từ các request Bruno trong `collections/Entrade`.
servers:
  - url: https://services.entrade.com.vn/entrade-api
    description: Môi trường production
  - url: https://services-staging.entrade.com.vn/papertrade-entrade-api
    description: Môi trường staging
security:
  - BearerAuth: []
tags:
  - name: authentication
    description: API đăng nhập và cấp JWT token.
    x-group: Xác thực
  - name: account
    description: Thông tin tài khoản, tài sản và cấu hình rủi ro.
    x-group: Tài khoản
  - name: derivatives
    description: Giao dịch, sức mua, gói vay và vị thế phái sinh.
    x-group: Phái sinh
  - name: smart-order
    description: Lệnh điều kiện trên dịch vụ Smart Order.
    x-group: Smart Order
paths:
  /derivative/orders:
    get:
      tags:
        - derivatives
      summary: Lấy sổ lệnh
      description: Lấy sổ lệnh (Order Book) của Phái Sinh.
      operationId: listDerivativeOrders
      parameters:
        - name: investorAccountId
          in: query
          description: Mã tiểu khoản
          schema:
            type: number
        - name: _start
          in: query
          description: Index lấy lệnh đầu tiên
          schema:
            type: number
        - name: _end
          in: query
          description: Index lấy lệnh cuối cùng
          schema:
            type: number
        - name: _sort
          in: query
          description: Field dùng để sort
          schema:
            type: string
        - name: _order
          in: query
          description: Thứ tự
          schema:
            type: string
      responses:
        '200':
          description: Thành công
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DerivativeOrderPage'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    DerivativeOrderPage:
      type: object
      properties:
        data:
          type: array
          description: Danh sách order
          items:
            $ref: '#/components/schemas/DerivativeOrder'
        total:
          type: number
          description: Tổng số các lệnh
        start:
          type: number
          description: Số bắt đầu, nên để là 0
        end:
          type: number
          description: Số kết thúc, để start = 0 thì đây là số lượng lệnh muốn trả về
    DerivativeOrder:
      type: object
      properties:
        id:
          type: number
          description: Số hiệu lệnh
        side:
          type: string
          description: 'Lệnh Mua/Bán thuộc các giá trị sau: NB: Mua; NS: Bán'
        investorId:
          type: number
          description: Mã khách hàng
        investorAccountId:
          type: number
          description: Số tiểu khoản
        bankId:
          type: number
        bankAccountId:
          type: number
        symbol:
          type: string
          description: Mã
        price:
          type: number
          description: Giá đặt
        quantity:
          type: number
          description: Khối lượng đặt
        orderType:
          type: string
          description: >-
            Loại lệnh, thuộc các giá trị sau: LO: lệnh giới hạn; MTL: lệnh thị
            trường; ATC/ATO: lệnh khớp phiên định kỳ đóng cửa/mở cửa; PLO: lệnh
            khớp lệnh sau giờ
        orderStatus:
          type: string
          description: >-
            Trạng thái lệnh, thuộc các giá trị sau: pending: chờ gửi;
            pendingNew: chờ gửi; new: chờ khớp; partiallyFilled: khớp một phần;
            filled: khớp toàn bộ; rejected: bị từ chối; expired: bị hết hạn
            trong phiên; doneForDay: lệnh hết hiệu lực khi hết phiên
        fillQuantity:
          type: number
          description: Khối lượng đã khớp
        lastQuantity:
          type: number
          description: Khối lượng của lần khớp gần nhất của lệnh
        lastPrice:
          type: number
          description: Giá khớp của lần khớp gần nhất của lệnh
        averagePrice:
          type: number
          description: Giá khớp trung bình của lệnh
        createdDate:
          type: string
          description: >-
            Thời điểm (ngày giờ) đặt lệnh, theo định dạng ISO UTC 8601 format
            datetime. Ví dụ: 2022-07-15T10:00:00.111+07:00
        modifiedDate:
          type: string
          description: Thời điểm (ngày giờ) thay đổi cuối cùng của lệnh
        bankMarginPortfolioId:
          type: number
          description: Id gói vay
        dealId:
          type: number
        tradingFee:
          type: number
        tradingTax:
          type: number
        orderSecure:
          type: number
        priceSecure:
          type: number
        marginRate:
          type: number
        quantitySecure:
          type: number
        leavesQuantity:
          type: number
        externalId:
          type: string
        error:
          type: string
        maker:
          type: string
        version:
          type: number
        type:
          type: string
        fillValue:
          type: number
    Error:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        status:
          type: number
  responses:
    BadRequest:
      description: Yêu cầu không hợp lệ
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Lỗi máy chủ
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token lấy từ API đăng nhập.

````

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