List Trigger Orders

Gets cancelled, pending or executed trigger orders for the provided subaccount and products.

Request

POST [TRIGGER_ENDPOINT]/query

Body


{
  "type": "list_trigger_orders",
  "tx": {
    "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43746573743000000000000000",
    "recvTime": "1688768157050"
  },
  "signature": "0x",
  "product_id": 1,
  "pending": false,
  "max_update_time": "1688768157050",
  "limit": 20
}

Request Parameters

Note: max_update_time It's the time that the trigger order last changed state. For example, if a trigger order is placed & pending, the update time = time of placement. If the trigger order is cancelled, then the update time = time of cancellation.

Signing

See more details and and examples in our signing page.

The solidity typed data struct that needs to be signed is:

struct ListTriggerOrders {
    bytes32 sender;
    uint64 recvTime;
}

sender: a bytes32 sent as a hex string; includes the address and the subaccount identifier

recvTime: the time in milliseconds (a recv_time) after which the transaction should be ignored by the trigger service. cannot be more than 100 seconds from the time it is received by the server.

Note: for signing you should always use the data type specified in the solidity struct which might be different from the type sent in the request e.g: recvTime should be an uint64 for Signing but should be sent as a string in the final payload.

Response

Success

{
  "status": "success",
  "data": {
    "orders": [
      {
        "order": {
          "order": {
            "sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
            "priceX18": "1000000000000000000",
            "amount": "1000000000000000000",
            "expiration": "2000000000",
            "nonce": "1",
          },
          "signature": "0x...",
          "product_id": 1,
          "spot_leverage": true,
          "trigger": {
            "price_above": "1000000000000000000"
          },
          "digest": "0x..."
        },
        "status": "pending",
        "updated_at": 1688768157050
      }
    ]
  },
  "request_type": "query_list_trigger_orders"
}

Note: trigger orders can have the following statuses:

  • pending: initial state. trigger criteria has not been met nor has it been cancelled.

  • triggered: trigger criteria was met, and order was submitted for execution.

  • cancelled: trigger order was cancelled due to any of the following: user requested via cancel trigger order, order expired, account becomes unhealthy if order is triggered.

Failure

{
  "status": "failure",
  "signature": {signature}
  "error": "{error_msg}"
  "error_code": {error_code}
  "request_type": "query_list_trigger_orders"
}

Last updated