getTrades

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

Request: requestType is getTrades asset is the asset ID 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) includeAssetInfo is true if the decimals and name fields are to be included (optional)

Response:

(A) trades is the array of trade objects with the following fields for each trade:

  • (S) seller is the account number of the seller

  • (S) quantityQNT is the quantity (in QNT) of the asset traded

  • (S) bidOrder is the bid order ID

  • (S) sellerRS is the Reed-Solomon address of the seller

  • (S) buyer is the account number of the buyer

  • (S) priceNQT is the trade price (in NQT, the ask price for a buy or the bid price for a sell)

  • (S) askOrder is the ask order ID

  • (S) buyerRS is the Reed-Solomon address of the buyer

  • (N) decimals is the number of decimal places used by the asset

  • (S) name is the name of the asset (if includeAssetInfo is true)

  • (S) block is the block ID of the trade (if includeAssetInfo is true)

  • (S) asset is the asset ID

  • (N) askOrderHeight is the block height of the ask order

  • (N) bidOrderHeight is the block height of the bid order

  • (S) tradeType 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)

  • (N) timestamp is the timestamp (in seconds since the genesis block) of the trade block

  • (N) height is the height of the trade block

(N) requestProcessingTime is the API request processing time (in millisec)

Example:

Request:

http://localhost:801/BEAM?requestType=getTrades&asset=3702027329806229573&lastIndex=2&includeAssetInfo=false

Response:

{ “trades”: [ { “seller”: “2695253629713716937”, “quantityQNT”: “7700”, “bidOrder”: “17489219850997945774”, “sellerRS”: “BEAM-7X92-29W5-6VE2-4QVTC”, “buyer”: “14676337193484961173”, “priceNQT”: “100000”, “askOrder”: “7125231493760146086”, “buyerRS”: “BEAM-7X92-29W5-6YPW-EL8DR”, “block”: “10810208340839229954”, “asset”: “3702027329806229573”, “askOrderHeight”: 504189, “tradeType”: “sell”, “timestamp”: 122140342, “height”: 504949 }, { “seller”: “13248005565246971693”, “quantityQNT”: “100000”, “bidOrder”: “6312065606850043247”, “sellerRS”: “BEAM-7X92-29W5-X6SQ-DYLQH”, “buyer”: “9582909050628712440”, “priceNQT”: “120000”, “askOrder”: “17472059594274895773”, “buyerRS”: “BEAM-7X92-29W5-45QV-APCZB”, “block”: “12097007668561592790”, “asset”: “3702027329806229573”, “askOrderHeight”: 504899, “tradeType”: “buy”, “timestamp”: 122129038, “height”: 504899 } ], “requestProcessingTime”: 1 }

Last updated