LBank Orders API

Order placement, cancellation, and query

OpenAPI Specification

lbank-orders-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: LBank Spot Market REST Account Orders API
  description: Public REST endpoints providing real-time and historical market data for all LBank spot trading pairs. All endpoints are unauthenticated and suitable for market data aggregators, dashboards, and trading bots.
  version: 1.0.0
  contact:
    url: https://www.lbank.com/en-US/docs/
  termsOfService: https://www.lbank.com/en-US/agreement/
servers:
- url: https://api.lbkex.com
  description: LBank REST API (primary)
- url: https://api.lbkex.net
  description: LBank REST API (secondary)
- url: https://api.lbank.info
  description: LBank REST API (tertiary)
tags:
- name: Orders
  description: Order placement, cancellation, and query
paths:
  /v1/create_order.do:
    post:
      operationId: createOrder
      summary: Place a spot order
      description: Places a new buy or sell limit/market order on the spot market. Returns the order ID on success.
      tags:
      - Orders
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - $ref: '#/components/schemas/AuthRequest'
              - type: object
                required:
                - symbol
                - type
                - price
                - amount
                properties:
                  symbol:
                    type: string
                    description: Trading pair (e.g. eth_btc)
                    example: eth_btc
                  type:
                    type: string
                    enum:
                    - buy
                    - sell
                    - buy_market
                    - sell_market
                    - buy_maker
                    - sell_maker
                    - buy_ioc
                    - sell_ioc
                    - buy_fok
                    - sell_fok
                    description: Order type
                  price:
                    type: string
                    description: Order price (must be greater than 0)
                    example: '5323.42'
                  amount:
                    type: string
                    description: Order quantity
                    example: '3'
      responses:
        '200':
          description: Order placement result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOrderResponse'
      security:
      - ApiKeyAuth: []
  /v1/cancel_order.do:
    post:
      operationId: cancelOrder
      summary: Cancel an order
      description: Cancels one or more open orders. For multiple orders, separate order IDs with commas (max 3 per request).
      tags:
      - Orders
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - $ref: '#/components/schemas/AuthRequest'
              - type: object
                required:
                - symbol
                - order_id
                properties:
                  symbol:
                    type: string
                    description: Trading pair (e.g. eth_btc)
                  order_id:
                    type: string
                    description: Order ID(s). Use comma to join multiple orders (max 3)
      responses:
        '200':
          description: Cancellation result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelOrderResponse'
      security:
      - ApiKeyAuth: []
  /v1/orders_info.do:
    post:
      operationId: getOrderInfo
      summary: Query order status
      description: Returns status and details for one or more orders by order ID. Comma-separate multiple order IDs (max 3).
      tags:
      - Orders
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - $ref: '#/components/schemas/AuthRequest'
              - type: object
                required:
                - symbol
                - order_id
                properties:
                  symbol:
                    type: string
                    description: Trading pair
                  order_id:
                    type: string
                    description: Order ID(s). Comma-separated for multiple (max 3)
      responses:
        '200':
          description: Order information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrdersInfoResponse'
      security:
      - ApiKeyAuth: []
  /v1/orders_info_history.do:
    post:
      operationId: getOrderHistory
      summary: Get order history
      description: Returns historical order records for a trading pair. Only records from the last 7 days are available.
      tags:
      - Orders
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - $ref: '#/components/schemas/AuthRequest'
              - type: object
                required:
                - symbol
                - current_page
                - page_length
                properties:
                  symbol:
                    type: string
                    description: Trading pair
                  current_page:
                    type: string
                    description: Current page number
                  page_length:
                    type: string
                    description: Records per page (max 200)
                  status:
                    type: string
                    description: Filter by order status
      responses:
        '200':
          description: Paginated order history
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrdersHistoryResponse'
      security:
      - ApiKeyAuth: []
  /v1/orders_info_no_deal.do:
    post:
      operationId: getOpenOrders
      summary: Get open orders
      description: Returns all currently open (unfilled) orders for a trading pair.
      tags:
      - Orders
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - $ref: '#/components/schemas/AuthRequest'
              - type: object
                required:
                - symbol
                - current_page
                - page_length
                properties:
                  symbol:
                    type: string
                    description: Trading pair
                  current_page:
                    type: string
                    description: Current page number
                  page_length:
                    type: string
                    description: Records per page (max 200)
      responses:
        '200':
          description: Open orders list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrdersHistoryResponse'
      security:
      - ApiKeyAuth: []
  /v1/order_transaction_detail.do:
    post:
      operationId: getOrderTransactionDetail
      summary: Get order transaction details
      description: Returns detailed trade fill records for a specific order.
      tags:
      - Orders
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              allOf:
              - $ref: '#/components/schemas/AuthRequest'
              - type: object
                required:
                - symbol
                - order_id
                properties:
                  symbol:
                    type: string
                    description: Trading pair
                  order_id:
                    type: string
                    description: Order ID
      responses:
        '200':
          description: Order transaction details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionDetailResponse'
      security:
      - ApiKeyAuth: []
components:
  schemas:
    TransactionRecord:
      type: object
      properties:
        txUuid:
          type: string
          description: Trade ID
        orderUuid:
          type: string
          description: Order ID
        tradeType:
          type: string
          enum:
          - buy
          - sell
        dealTime:
          type: integer
          description: Trade timestamp (milliseconds)
        dealPrice:
          type: number
          description: Fill price
        dealQuantity:
          type: number
          description: Fill quantity
        dealVolumePrice:
          type: number
          description: Aggregated fill value (price * quantity)
        tradeFee:
          type: number
          description: Transaction fee amount
        tradeFeeRate:
          type: number
          description: Transaction fee rate
    OrdersHistoryResponse:
      type: object
      properties:
        result:
          type: string
          enum:
          - 'true'
          - 'false'
        orders:
          type: array
          items:
            $ref: '#/components/schemas/Order'
        current_page:
          type: string
        page_length:
          type: string
        total:
          type: string
          description: Total number of records
    CancelOrderResponse:
      type: object
      properties:
        result:
          type: string
          enum:
          - 'true'
          - 'false'
          description: Success/failure for single order
        order_id:
          type: string
          description: Order ID (single order)
        success:
          type: string
          description: Comma-separated list of successfully cancelled order IDs (multiple orders)
        error:
          type: string
          description: Comma-separated list of failed order IDs (multiple orders)
    TransactionDetailResponse:
      type: object
      properties:
        result:
          type: string
          enum:
          - 'true'
          - 'false'
        transaction:
          type: array
          items:
            $ref: '#/components/schemas/TransactionRecord'
    CreateOrderResponse:
      type: object
      properties:
        result:
          type: string
          enum:
          - 'true'
          - 'false'
        order_id:
          type: string
          description: Order ID
    Order:
      type: object
      properties:
        symbol:
          type: string
          description: Trading pair
        order_id:
          type: string
          description: Order ID
        amount:
          type: number
          description: Order quantity
        price:
          type: number
          description: Order price
        avg_price:
          type: number
          description: Average fill price
        type:
          type: string
          enum:
          - buy
          - sell
          description: Order direction
        deal_amount:
          type: number
          description: Filled quantity
        create_time:
          type: integer
          description: Order creation timestamp (milliseconds)
        status:
          type: integer
          description: 'Order status: -1=Cancelled, 0=Open, 1=Partially filled, 2=Fully filled, 3=Partially filled and cancelled, 4=Cancelling'
    AuthRequest:
      type: object
      required:
      - api_key
      - sign
      properties:
        api_key:
          type: string
          description: User's API key
        sign:
          type: string
          description: Request signature (RSA or HmacSHA256)
    OrdersInfoResponse:
      type: object
      properties:
        result:
          type: string
          enum:
          - 'true'
          - 'false'
        orders:
          type: array
          items:
            $ref: '#/components/schemas/Order'