# 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](/tech/api-documentation/account/login.md) section of the documentation.

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

```url
wss://api.brine.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
  }
}
```


---

# 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.brine.fi/tech/api-documentation/web-socket-stream/private-web-socket-connection.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.
