# Private web-socket connection

Make use of this private web-socket connection to get real-time information about your personal trades and orders. Please note that this is a <mark style="background-color:purple;">Private 🔒</mark> route which means it needs to be authorised by the account initiating this request.

> Note: You will need to include the JWT Auth token to request headers to access this endpoint. To get the JWT Auth Token, refer the [login](https://docs.tanx.fi/tech/api-documentation/account/login) section of the documentation.

### URL <a href="#url" id="url"></a>

```url
wss://api.tanx.fi/private?auth_header=<JWT Access Token>
```

### Subscribe <a href="#subscribe" id="subscribe"></a>

```json
{ "event": "subscribe", "streams": ["trade", "order"] }
```

### Unsubscribe <a href="#unsubscribe" id="unsubscribe"></a>

```json
{ "event": "unsubscribe", "streams": ["trade", "order"] }
```

### Available Streams <a href="#available-streams" id="available-streams"></a>

#### 1. Trade Streams \[for trade updates] <a href="#id-1-trade-streams-for-trade-updates" id="id-1-trade-streams-for-trade-updates"></a>

#### Response

```json
{
  "trade": {
    "amount": "0.001",
    "created_at": 1659024869,
    "id": 448640,
    "market": "btcusdc",
    "order_id": 8840859,
    "price": "23829.22",
    "side": "buy",
    "taker_type": "buy",
    "total": "23.82922"
  }
}
```

#### 2. Order Streams \[for order updates] <a href="#id-2-order-streams-for-order-updates" id="id-2-order-streams-for-order-updates"></a>

#### Response

```json
{
  "order": {
    "at": 1659024868,
    "avg_price": "23829.22",
    "created_at": 1659024868,
    "executed_volume": "0.001",
    "id": 8840859,
    "kind": "bid",
    "market": "btcusdc",
    "ord_type": "limit",
    "origin_volume": "0.001",
    "price": "24000.0",
    "remaining_volume": "0.0",
    "side": "buy",
    "state": "done",
    "trades_count": 1,
    "updated_at": 1659024869
  }
}
```
