> ## 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 Phái Sinh

> Đặt lệnh Phái Sinh (Long/Short).



## OpenAPI

````yaml /vi/openapi/entrade-v1.yaml post /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:
    post:
      tags:
        - derivatives
      summary: Đặt lệnh Phái Sinh
      description: Đặt lệnh Phái Sinh (Long/Short).
      operationId: placeDerivativeOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                bankMarginPortfolioId:
                  type: number
                  description: Id gói vay
                investorId:
                  type: number
                  description: Mã khách hàng
                symbol:
                  type: string
                  description: Mã phái sinh, ví dụ VN30F2306
                price:
                  type: number
                  description: Giá
                orderType:
                  type: string
                  description: 'Loại lệnh: LO/MTL/ATO/ATC/MOK/MAK'
                side:
                  type: string
                  description: 'Lệnh mua: NB, lệnh bán: NS'
                quantity:
                  type: number
                  description: Khối lượng đặt
      responses:
        '200':
          description: Thành công
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DerivativeOrder'
        '400':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    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.