# Orderbook

## Stream order blocks in certain orderbooks in Standard spot exchange

### ✅ Request

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

```json
{
  "id": 1,
  "method": "spot.orderbook.subscribe.pairs",
  "params": {
    "books": [{
      "pair": "ETH/USDC",
      "step": "0.1"
    },
    {
      "pair": "WBTC/USDT",
      "step": "0.01"
    }]
  }
}
```

{% endcode %}
{% endtab %}

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

```json
{
  "id": 1,
  "method": "spot.orderbook.unsubscribe.pairs",
  "params": {
    "books": [{
      "pair": "ETH/USDC",
      "step": "0.1",  
    },
    {
      "pair": "WBTC/USDT",
      "step": "0.01"
    }]
  }
}
```

{% 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 Block Stream" %}

```json
[
  "spotOrderBlock" // eventId
  true,            // isBid (buy order)
  3142.75,         // price
  1.5,             // baseVolume (ETH)
  4714.13,         // quoteVolume (USDC)
  2,               // scale
  1713659500       // timestamp
]
```

{% endcode %}

### 📄 Field Descriptions

| Index | Field         | Type      | Description                              |
| ----- | ------------- | --------- | ---------------------------------------- |
| 0\`   | `eventId`     | `string`  | Unique event identifier                  |
| 1     | `isBid`       | `boolean` | `true` for bid, `false` for ask          |
| 2     | `price`       | `float`   | Price of the update                      |
| 3     | `baseVolume`  | `float`   | Volume in base token                     |
| 4     | `quoteVolume` | `float`   | Volume in quote token                    |
| 5     | `scale`       | `float`   | Decimal scale of the price or bucket     |
| 6     | `timestamp`   | `integer` | UNIX timestamp of the event (in seconds) |
