# historicalOrders

Get the latest order status updates of a certain user.

{% hint style="info" %}
**Data available from 7th of Aug 2025**
{% endhint %}

## POST Request

<table><thead><tr><th width="161.9998779296875">Field</th><th width="119">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>type</code></td><td>string</td><td>Must be <code>"historicalOrders"</code></td></tr><tr><td><code>user</code></td><td>string</td><td>Ethereum address (0x-prefixed, 42 characters)</td></tr><tr><td><code>limit</code></td><td>integer</td><td>Max results to return, default and max 2000 (optional)</td></tr></tbody></table>

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X POST https://api.hydromancer.xyz/info \
  -H "Authorization: Bearer $HYDROMANCER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "historicalOrders",
    "user": "0x0000000000000000000000000000000000000000"
  }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import os

response = requests.post(
    'https://api.hydromancer.xyz/info',
    json={
        'type': 'historicalOrders',
        'user': '0x0000000000000000000000000000000000000000'
    },
    headers={
        'Authorization': f'Bearer {os.environ.get("HYDROMANCER_API_KEY")}',
        'Content-Type': 'application/json'
    }
)

print(response.json())
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
import axios from 'axios';

try {
    const response = await axios.post('https://api.hydromancer.xyz/info', {
        type: 'historicalOrders',
        user: '0x0000000000000000000000000000000000000000'
    }, {
        headers: {
            'Authorization': `Bearer ${process.env.HYDROMANCER_API_KEY}`,
            'Content-Type': 'application/json'
        }
    });

    console.log(response.data);
} catch (error) {
    console.error('Error:', error.message);
}
```

{% endtab %}
{% endtabs %}

***

## Response Fields

| Field                    | Type    | Description                                                |
| ------------------------ | ------- | ---------------------------------------------------------- |
| `builder`                | string  | Builder address if order was placed via builder (optional) |
| `builderFee`             | int     | Builder fee in basis points (optional)                     |
| `txIndex`                | int     | Transaction index                                          |
| `order`                  | object  | Order details (see Order Object below)                     |
| `status`                 | string  | Order status (see status values below)                     |
| `statusTimestamp`        | int     | Timestamp of status update in milliseconds                 |
| `order.coin`             | string  | Asset symbol                                               |
| `order.side`             | string  | `"A"` (sell) or `"B"` (buy)                                |
| `order.limitPx`          | string  | Limit price                                                |
| `order.sz`               | string  | Order size                                                 |
| `order.oid`              | int     | Order ID                                                   |
| `order.timestamp`        | int     | Order creation timestamp in milliseconds                   |
| `order.triggerCondition` | string  | Trigger condition if applicable                            |
| `order.isTrigger`        | boolean | Whether order is a trigger order                           |
| `order.triggerPx`        | string  | Trigger price                                              |
| `order.children`         | array   | Child orders for take profit/stop loss orders              |
| `order.isPositionTpsl`   | boolean | Whether order is position TP/SL                            |
| `order.reduceOnly`       | boolean | Whether order is reduce-only                               |
| `order.orderType`        | string  | Order type (e.g. `"Limit"`, `"Market"`)                    |
| `order.origSz`           | string  | Original order size                                        |
| `order.tif`              | string  | Time in force, e.g. `"Gtc"`, `"Ioc"`, `"Alo"` (optional)   |
| `order.cloid`            | string  | Client order ID (optional)                                 |

<details>

<summary>Response</summary>

```json
[
  {
    "builder": "0x...", // optional
    "builderFee": 100, // optional
    "txIndex": 12,
    "order": {
      "coin": "BTC",
      "side": "B",
      "limitPx": "45000.00",
      "sz": "0.5",
      "oid": 123456,
      "timestamp": 1234567890123,
      "triggerCondition": "tp",
      "isTrigger": false,
      "triggerPx": "0.00",
      "children": [],
      "isPositionTpsl": false,
      "reduceOnly": false,
      "orderType": "Limit",
      "origSz": "0.5",
      "tif": "Gtc", // optional
      "cloid": "client-order-123" // optional
    },
    "status": "filled",
    "statusTimestamp": 1234567890123
  }
]
```

</details>

<details>

<summary>Status values</summary>

**Active:**

* `open` - Order is resting on the orderbook
* `triggered` - Stop/trigger order was triggered
* `scheduledCancel` - Order is scheduled for cancellation

**Filled:**

* `filled` - Order completely filled

**Canceled:**

* `canceled` - Canceled by user
* `marginCanceled` - Insufficient margin
* `liquidatedCanceled` - Position was liquidated
* `delistedCanceled` - Asset was delisted
* `reduceOnlyCanceled` - Reduce-only order canceled (no position)
* `selfTradeCanceled` - Would have resulted in self-trade
* `siblingFilledCanceled` - Sibling TP/SL order filled
* `vaultWithdrawalCanceled` - Vault withdrawal triggered cancellation
* `openInterestCapCanceled` - Open interest cap reached

**Rejected:**

* `badAloPxRejected` - ALO price would cross the book
* `iocCancelRejected` - IOC order couldn't fill
* `reduceOnlyRejected` - Reduce-only order rejected
* `oracleRejected` - Oracle price check failed
* `perpMarginRejected` - Insufficient perp margin
* `perpMaxPositionRejected` - Max position size exceeded
* `openInterestIncreaseRejected` - Open interest increase rejected
* `positionFlipAtOpenInterestCapRejected` - Position flip at OI cap rejected
* `positionIncreaseAtOpenInterestCapRejected` - Position increase at OI cap rejected
* `tooAggressiveAtOpenInterestCapRejected` - Too aggressive at OI cap
* `minTradeNtlRejected` - Below minimum trade notional
* `insufficientSpotBalanceRejected` - Insufficient spot balance

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hydromancer.xyz/readme/rest-api/historical-data/historicalorders.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
