Skip to content

List Orders

Retrieves the order history for a portfolio, including all order types and their current status. This endpoint is accessed through the organization API.

Request URL

GET https://ddp.definitive.fi/v2/organization/portfolios/{portfolioId}/orders

Path Parameters

ParameterTypeRequiredDescription
portfolioIdstringYesUUID of the portfolio

Query Parameters

ParameterTypeRequiredDescriptionDefault
limitnumberNoMaximum number of orders to return20
cursorstringNoISO 8601 timestamp for pagination (order createdAt)-

Example

const queryParams = {
  limit: 10,
  cursor: "2025-06-05T01:26:30.560Z"
};
 
const json = await AuthHelpers.signAndSend({
  path: "/v2/organization/portfolios/00000000-0000-0000-0000-000000000001/orders",
  method: "GET",
  queryParams,
  organizationId: "00000000-0000-0000-0000-000000000000",
  apiKey: process.env.API_KEY,
  apiSecret: process.env.API_SECRET,
});
console.log(json);

Response

{
  orders: [
    {
      "contraAsset": {
        "id": "00000000-0000-0000-0000-000000000001",
        "name": "Hyperliquid",
        "address": "1000003",
        "ticker": "HYPE",
        "chain": {
          "name": "Hyperevm",
          "id": "999",
          "namespace": "eip155"
        }
      },
      "targetAsset": {
        "id": "00000000-0000-0000-0000-000000000002",
        "name": "SUPERMILK",
        "address": "0xfe69bc93b936b34d371defa873686c116c8488c2",
        "ticker": "MILK",
        "chain": {
          "name": "Hyperevm",
          "id": "999",
          "namespace": "eip155"
        }
      },
      "contraAmount": "27.54374",
      "targetAmount": "2678483.226019",
      "orderDate": "2025-06-05T07:36:49.045Z",
      "orderSide": "ORDER_SIDE_SELL",
      "rate": "35.43",
      "contraNotional": "975.8747082",
      "vaultId": "00000000-0000-0000-0000-000000000003",
      "status": "ORDER_STATUS_FILLED",
      "portfolioId": "00000000-0000-0000-0000-000000000004",
      "organizationName": "Example Organization",
      "closedAt": "2025-06-06T07:34:43.048Z",
      "orderId": "00000000-0000-0000-0000-000000000005",
      "size": "27.54374",
      "filledSize": "27.54374",
      "type": "ORDER_TYPE_TWAP",
      "acceptedAt": "2025-06-05T07:36:49.403Z",
      "maxPriceImpact": "0.05",
      "closeReason": "REASON_FULLY_FILLED"
    }
    // ... additional orders
  ],
  limit: 10,
  nextCursor: "2024-08-05T20:48:11.584Z", // ISO timestamp for next page
  hasNextPage: true
}

Pagination

This endpoint uses cursor-based pagination based on the createdAt timestamp:

  • First Request: Omit the cursor parameter
  • Subsequent Requests: Use the nextCursor value from the previous response
  • End of Data: When hasNextPage is false, there are no more orders to fetch
  • Cursor Format: The cursor is an ISO 8601 timestamp string (e.g., "2024-08-05T20:48:11.584Z")

Pagination Example

let cursor = null;
let allOrders = [];
 
do {
  const queryParams = { limit: 50 };
  if (cursor) queryParams.cursor = cursor;
 
  const response = await AuthHelpers.signAndSend({
    path: `/v2/organization/portfolios/${portfolioId}/orders`,
    method: "GET",
    queryParams,
    organizationId: process.env.ORG_ID,
    apiKey: process.env.API_KEY,
    apiSecret: process.env.API_SECRET,
  });
 
  allOrders.push(...response.orders);
  cursor = response.nextCursor;
} while (response.hasNextPage);