# Orders

## Stream orders in an accounts in Standard spot exchange

### ✅ Request

{% tabs %}
{% tab title="Subscription" %}
{% code title="Subscription" %}

```json
{
  "id": 1,
  "method": "spot.orders.subscribe.accounts",
  "params": {
    "addresses": ["0x0000000000000000000000000000000000000000"]
  }
}
```

{% endcode %}
{% endtab %}

{% tab title="Unsubscription" %}
{% code title="Unsubscription" %}

```json
{
  "id": 1,
  "method": "spot.orders.unsubscribe.accounts",
  "params": {
    "addresses": ["0x0000000000000000000000000000000000000000"]
  }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### 📤 Response

{% tabs %}
{% tab title="Success" %}
{% code title="Success" %}

```json
{
  "result": null,
  "id": 1
}
```

{% endcode %}
{% endtab %}

{% tab title="Error" %}
{% code title="Error" %}

```json
{
  "code": 1,
  "msg": "Internal Error: {error}"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### 📡 Streamed Data Format

{% code title="Order Stream" %}

```json
[
  "spotOrder"                   // eventId
  true,                         // isBid (true = buy order, false = sell order)
  987654,                       // orderId
  "0xBaseTokenAddress",         // base token address
  "ETH",                        // base token symbol
  "0xQuoteTokenAddress",        // quote token address
  "USDC",                       // quote token symbol
  "ETH/USDC",                   // pair symbol
  "0xPairContractAddress",      // pair contract address
  3142.25,                      // price
  "0xAssetTokenAddress",        // traded asset address
  "ETH",                        // traded asset symbol
  2.0,                          // amount
  6284.5,                       // placed value (commonly price * amount)
  1713657900,                   // timestamp (Unix)
  "0xUserAddress",              // account placing the order
  "0xTransactionHash"           // transaction hash
]

```

{% endcode %}

### 📄 Field Descriptions

| Index | Field         | Type      | Description                                |
| ----- | ------------- | --------- | ------------------------------------------ |
| 0     | `eventId`     | `string`  | Unique event identifier                    |
| 1     | `isBid`       | `boolean` | Whether the trade is a bid or ask          |
| 2     | `orderId`     | `integer` | Order ID of the trade                      |
| 3     | `base`        | `string`  | Base token address                         |
| 4     | `baseSymbol`  | `string`  | Symbol of base token                       |
| 5     | `quote`       | `string`  | Quote token address                        |
| 6     | `quoteSymbol` | `string`  | Symbol of quote token                      |
| 7     | `pairSymbol`  | `string`  | Symbol of the trading pair (e.g. ETH/USDT) |
| 8     | `pair`        | `string`  | Contract address of the trading pair       |
| 9     | `price`       | `float`   | Price of the trade                         |
| 10    | `asset`       | `string`  | Asset address involved in the trade        |
| 11    | `assetSymbol` | `string`  | Symbol of the asset                        |
| 12    | `amount`      | `float`   | Amount of the asset traded                 |
| 13    | `placed`      | `float`   | Amount placed (likely base × price)        |
| 14    | `timestamp`   | `integer` | Unix timestamp of the trade                |
| 15    | `account`     | `string`  | Address of the trader or executor          |
| 16    | `txHash`      | `string`  | Transaction hash                           |

### 📡 Streamed Data Format

```json
[
  "deleteSpotOrder"             // eventId
  true,                         // isBid (true = buy order, false = sell order)
  "0xPairContractAddress",      // trading pair contract address
  "0xUserAddress",              // account that placed the order
  123456,                       // orderId
  1713657900                    // timestamp (Unix)
]
```

### 📄 Field Descriptions

| Index | Field       | Type      | Description                                  |
| ----- | ----------- | --------- | -------------------------------------------- |
| 0     | `eventId`   | `string`  | Unique event identifier                      |
| 1     | `isBid`     | `boolean` | `true` for bid (buy), `false` for ask (sell) |
| 2     | `pair`      | `string`  | Address of the trading pair contract         |
| 3     | `account`   | `string`  | Address of the user whose order was removed  |
| 4     | `orderId`   | `number`  | Unique identifier of the deleted order       |
| 5     | `timestamp` | `number`  | Unix timestamp of deletion event             |
