Skip to content

Get Trades

Get trades associated with a given asset and/or account in reverse block height order.

Request:

  • requestType is getTrades
  • asset is the asset ID (optional)
  • account is the account ID (optional if asset provided)
  • firstIndex is a zero-based index to the first trade to retrieve (optional)
  • lastIndex is a zero-based index to the last trade to retrieve (optional)
  • timestamp is the earliest block (in seconds since the genesis block) to retrieve (optional)
  • includeAssetInfo is true if the decimals and name fields are to be included (optional)
  • requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
  • requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)

Response:

  • trades (A) is an array of trade objects with the following fields for each trade:
    • seller (S) is the account number of the seller
    • quantityQNT (S) is the quantity (in QNT) of the asset traded
    • bidOrder (S) is the bid order ID
    • sellerRS (S) is the Reed-Solomon address of the seller
    • buyer (S) is the account number of the buyer
    • priceTQT (S) is the trade price (in TQT, the ask price for a buy or the bid price for a sell)
    • askOrder (S) is the ask order ID
    • buyerRS (S) is the Reed-Solomon address of the buyer
    • decimals (N) is the number of decimal places used by the asset
    • name (S) is the name of the asset (if includeAssetInfo is true)
    • block (S) is the block ID of the trade (if includeAssetInfo is true)
    • asset (S) is the asset ID
    • askOrderHeight (N) is the block height of the ask order
    • bidOrderHeight (N) is the block height of the bid order
    • tradeType (S) is the trade type (sell or buy, where buy implies that the bid occurred after the ask, or if in the same block, has a greater order ID)
    • timestamp (N) is the timestamp (in seconds since the genesis block) of the trade block
    • height (N) is the height of the trade block
  • lastBlock (S) is the last block ID on the blockchain (applies if requireBlock is provided but not requireLastBlock)
  • requestProcessingTime (N) is the API request processing time (in millisec)