Docs
Version 0 (v0)
DCA
Orders

DCA Orders v0 API

Overview

This endpoint retrieves a list of Dollar-Cost Averaging (DCA) orders for a specified account. This endpoint supports pagination and filtering options to manage the returned data effectively.

💡
This API is rate-limited to 10 requests per 5 seconds per IP address.

Endpoint

https://api.swapscanner.io/v0/dca/orders?account=0x[ACCOUNT_ADDRESS]

Query Parameters

  • account (required): The account address for which DCA orders are to be retrieved. Must be a valid address.
  • before (optional): A timestamp (in milliseconds) to retrieve orders created before this time.
  • openOrdersOnly (optional): A boolean value (passed as 'true') to filter and return only open orders.

Response Structure

The endpoint returns a JSON object with the following properties:

  • orders (array): A list of DCA orders with the following fields:
    • order (object): Details of the order, including:
      • orderID (string): Unique identifier for the order.
      • maker (string): Address of the account that created the order.
      • beneficiary (string): Address of the account receiving the benefits.
      • tokenIn (string): Token address being exchanged.
      • amountInPerCycle (string): Amount of the token to be exchanged per cycle.
      • tokenOut (string): Token address being received.
      • minAmountOutPerCycle (string): Minimum amount of the token to be received per cycle.
      • maxAmountOutPerCycle (string): Maximum amount of the token to be received per cycle.
      • nonce (string): A unique number used to prevent replay attacks.
      • cycleInterval (string): Interval between each execution in seconds.
      • totalCycles (string): Total number of executions planned for the order.
      • lastCycleTimestamp (string): Timestamp of the last execution completed.
      • cyclesCompleted (string): Number of executions completed.
      • and other fields.
    • evaluateAfter (ISO 8601 timestamp): The next evaluation time for the order. The keeper will evaluate the order after this time using our Quote API.
    • status (string): The current status of the order: opened or closed.
    • ackAt (ISO 8601 timestamp): The acknowledgment timestamp for the order.
    • updatedAt (ISO 8601 timestamp): The last updated timestamp for the order.
    • retries (number): The number of retries for the order. If the order fails by any reason(e.g slippage or insufficient liquidity), the keeper will retry the order.
    • transactionHash (string): The hash of the openOrder() transaction of the order.
    • blockNumber (number): The block number where the order was recorded.
    • blockTimestamp (ISO 8601 timestamp): The timestamp of the block where the order was recorded.
  • nextBefore (number|undefined): A timestamp for the next page of results. If no additional results are available, this will be undefined.

Example

{
  "orders": [
    {
      "order": {
        "orderID": "0x[ORDER_ID]",
        "openBeforeTimestamp": "1733109811",
        "maker": "0x[MAKER_ADDRESS]",
        "beneficiary": "0x[BENEFICIARY_ADDRESS]",
        "tokenIn": "0x0000000000000000000000000000000000000000",
        "amountInPerCycle": "120750000",
        "tokenOut": "0x8888888888885b073f3c81258c27e83db228d5f3",
        "minAmountOutPerCycle": "1",
        "maxAmountOutPerCycle": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
        "nonce": "54",
        "startTimestamp": "1733109511",
        "cycleInterval": "300",
        "totalCycles": "4",
        "metadataHash": "0x[META_HASH]",
        "lastCycleTimestamp": "1733110197",
        "cyclesCompleted": "4"
      },
      "evaluateAfter": "2024-12-02T03:40:23.000Z",
      "status": "closed",
      "ackAt": "2024-12-02T03:18:50.607Z",
      "updatedAt": "2024-12-02T03:35:17.684Z",
      "retries": 0,
      "transactionHash": "0x[TRANSACTION_HASH]",
      "blockNumber": 171095132,
      "blockTimestamp": 1733109528000
    }
  ],
  "nextBefore": 1733038350377
}

Error Responses

  • 400 Bad Request: Invalid or missing query parameters.
  • 429 Too Many Requests: Rate limit exceeded.
  • 500 Internal Server Error: Unexpected server error.