# Order Executed

The executions channel streams order status and execution events for this account.&#x20;

{% hint style="info" %}
This channel contains account specific data, an authentication token is required in the request. Follow this [documentation ](https://docs.niza.io/websocket-api-1.0/websocket-authentication)how to get an authentication token.
{% endhint %}

### Subscribe with Pusher

```javascript
var channel = pusher.subscribe("private-order-executed.{userId}");
```

### Subscribe Request Payload

```javascript
{
   "event": "pusher:subscribe",
   "data": {
       "auth": "cd02139a35ead0a82ef6:672560a4d0f83cf5053cf509157ee24009c674188b58b71dd2f98647d9cab1df",
       "channel": "private-order-executed.{userId}"
   }
}
```

### Examples

<details>

<summary>Pusher</summary>

```javascript
var channel = pusher.subscribe("private-order-executed.{userId}");
```

</details>

<details>

<summary>WebSocket API in Javascript</summary>

```javascript
const message = {
        event: "pusher:subscribe",
        "data": {
            "auth": "cd02139a35ead0a82ef6:672560a4d0f83cf5053cf509157ee24009c674188b58b71dd2f98647d9cab1df",
            "channel": "private-order-executed.1"
         }
    };
socket.send(JSON.stringify(message));
```

</details>

### Payload

| Name                                       | Type           | Description                                                                |
| ------------------------------------------ | -------------- | -------------------------------------------------------------------------- |
| id                                         | integer        | Unique identifier for the order.                                           |
| user\_id                                   | integer        | ID of the user who placed the order.                                       |
| transaction\_id                            | string         | Unique transaction identifier for the order.                               |
| status                                     | string         | Current status of the order (e.g., "closed").                              |
| open\_time                                 | float          | Timestamp when the order was opened (in Unix time).                        |
| close\_time                                | float          | Timestamp when the order was closed (in Unix time).                        |
| expire\_time                               | float          | Expiry time of the order (set to 0 if not applicable).                     |
| reason                                     | string or null | Reason for the order closure, if applicable (null in this case).           |
| pair                                       | string         | Asset pair involved in the trade (e.g., "NIZAUSDT").                       |
| type                                       | string         | Type of order (e.g., "buy").                                               |
| order\_type                                | string         | The type of order (e.g., "limit").                                         |
| description                                | object         | Detailed description of the order.                                         |
| description.pair                           | string         | Asset pair being traded (e.g., "NIZAUSDT").                                |
| description.type                           | string         | Type of order (e.g., "buy").                                               |
| description.close                          | string         | Closing details, empty in this case.                                       |
| description.order                          | string         | Full description of the order (e.g., "buy 100.00000000 NIZAUSDT @ limit"). |
| description.price                          | string         | Price at which the order was executed.                                     |
| description.leverage                       | string         | Leverage used in the trade (e.g., "none").                                 |
| description.orderType                      | string         | Type of order (e.g., "limit").                                             |
| description.secondaryPrice                 | string or null | Secondary price, if applicable (null in this case).                        |
| volume.amount                              | string         | Volume of the asset being traded (e.g., "100.00000000").                   |
| volume.currency                            | string         | The asset being traded (e.g., "NIZA").                                     |
| volume\_executed.amount                    | string         | Amount of the asset that was executed (e.g., "100.00000000").              |
| volume\_executed.currency                  | string         | Currency of the executed volume (e.g., "NIZA").                            |
| fee.amount                                 | string         | Fee charged for the trade (e.g., "1.00000000").                            |
| fee.currency                               | string         | Currency in which the fee is paid (e.g., "NIZA").                          |
| price.amount                               | string         | Price at which the asset was traded (e.g., "100.00000000").                |
| price.currency                             | string         | Currency of the price (e.g., "USDT").                                      |
| secondary\_price                           | string or null | Secondary price, if applicable (null in this case).                        |
| limit\_price                               | string or null | Limit price, if applicable (null in this case).                            |
| cost.amount                                | string         | Total cost of the order (e.g., "10000.00000000").                          |
| cost.currency                              | string         | Currency in which the cost is calculated (e.g., "USDT").                   |
| [asset\_pair.id](http://asset_pair.id)     | integer        | Unique identifier of the asset pair.                                       |
| [asset\_pair.name](http://asset_pair.name) | string         | Name of the asset pair (e.g., "NIZAUSDT").                                 |
| asset\_pair.display\_name                  | string         | Display name of the asset pair (e.g., "NIZA/USDT").                        |
| asset\_pair.base\_name                     | string         | The base asset of the pair (e.g., "NIZA").                                 |
| asset\_pair.quote\_name                    | string         | The quote asset of the pair (e.g., "USDT").                                |
| trigger\_conditions                        | string         | Conditions that trigger the trade (e.g., "--").                            |
| trades                                     | array          | List of trades related to this order.                                      |
| trades\[0].id                              | integer        | Unique identifier for the trade.                                           |
| trades\[0].timestamp                       | string         | Timestamp of the trade (e.g., "2024-09-18 23:31:27").                      |
| trades\[0].type                            | string         | Type of trade (e.g., "buy").                                               |
| trades\[0].volume.amount                   | string         | Volume traded (e.g., "100.00000000").                                      |
| trades\[0].volume.currency                 | string         | Currency of the volume (e.g., "NIZA").                                     |
| trades\[0].price.amount                    | string         | Price at which the trade occurred (e.g., "100.00000000").                  |
| trades\[0].price.currency                  | string         | Currency pair of the trade (e.g., "NIZA/USDT").                            |
| trades\[0].cost.amount                     | string         | Total cost of the trade (e.g., "10000.00000000").                          |
| trades\[0].cost.currency                   | string         | Currency of the cost (e.g., "USDT").                                       |
| trades\[0].fee.amount                      | string         | Fee charged for the trade (e.g., "1.00000000").                            |
| trades\[0].fee.currency                    | string         | Currency of the fee (e.g., "NIZA").                                        |
| trades\[0].transaction\_id                 | string         | Unique transaction ID of the trade (e.g., "TJ6TZ7-RMUVA-BFLC44").          |
| socket                                     | string or null | Socket connection details, if applicable (null in this case).              |

### Example of the Payload

```json
{
   "id": 196857,
   "user_id": 4,
   "transaction_id": "OXUSHG-ND5YU-NJ6ILZ",
   "status": "closed",
   "open_time": "1726695085.0000",
   "close_time": "1726695087.6582",
   "expire_time": "0.0000",
   "reason": null,
   "pair": "NIZAUSDT",
   "type": "sell",
   "order_type": "limit",
   "description": {
       "pair": "NIZAUSDT",
       "type": "sell",
       "close": "",
       "order": "sell 100.00000000 NIZAUSDT @ limit",
       "price": "100.00000000",
       "leverage": "none",
       "orderType": "limit",
       "secondaryPrice": null
   },
   "volume": {
       "amount": "100.00000000",
       "currency": "NIZA"
   },
   "volume_executed": {
       "amount": "100.00000000",
       "currency": "NIZA"
   },
   "fee": {
       "amount": "100.00000000",
       "currency": "USDT"
   },
   "price": {
       "amount": "100.00000000",
       "currency": "USDT"
   },
   "secondary_price": null,
   "limit_price": null,
   "cost": {
       "amount": "10000.00000000",
       "currency": "USDT"
   },
   "asset_pair": {
       "id": 685,
       "name": "NIZAUSDT",
       "display_name": "NIZA\/USDT",
       "base_name": "NIZA",
       "quote_name": "USDT"
   },
   "trigger_conditions": "--",
   "trades": [
       {
           "id": 156391,
           "timestamp": "2024-09-18 23:31:27",
           "type": "sell",
           "volume": {
               "amount": "100.00000000",
               "currency": "NIZA"
           },
           "price": {
               "amount": "100.00000000",
               "currency": "NIZA\/USDT"
           },
           "cost": {
               "amount": "10000.00000000",
               "currency": "USDT"
           },
           "fee": {
               "amount": "100.00000000",
               "currency": "NIZA"
           },
           "transaction_id": "TGZA3R-ZVETW-RUIYAO"
       }
   ]
}
```
