# Feed 'L' - Counterparty limits

**Requests**

{% tabs %}
{% tab title="Subscribe" %}

```json
{"event": "bind", "feed": "L"}
```

{% endtab %}

{% tab title="Unsubscribe" %}

```json
{"event": "unbind", "feed": "L"}
```

{% endtab %}
{% endtabs %}

**Feed handling**

{% tabs %}
{% tab title="Definitions" %}

```json
limit =
{
  "counterpartyId": int,
  "tradingPermissions": {
    "ownTradingEnabled": bool,
    "mutualTradingEnabled": bool,
    "ownIncomingFlowEnabled": bool <optional>, // master-master connection only
    "mutualIncomingFlowEnabled": bool <optional>, // master-master connection only
    "ownOutgoingFlowEnabled": bool <optional>, // master-master connection only
    "mutualOutgoingFlowEnabled": bool <optional> // master-master connection only
  },
  "ownLimit": {
    "grossLimit": int,
    "asset": string,
    "limitUtilization": int,
    "equity": int,
    "maintenanceMargin": int <optional>,
    "restrictedTrading": int <optional>,
    "initialMargin": int <optional>
  } <optional>,
  "mutualLimit": {
    "grossLimit": int,
    "asset": string,
    "limitUtilization": int,
    "equity": int,
    "maintenanceMargin": int <optional>,
    "restrictedTrading": int <optional>,
    "initialMargin": int <optional>
  } <optional>
}
```

For the detailed counterparty limit description

{% content-ref url="/pages/K204rgg7mts5MpDH8KcH" %}
[climits](/api-reference/rest-api/risk-management/climits.md)
{% endcontent-ref %}
{% endtab %}

{% tab title="Possible updates" %}

```json
// snapshot
['L', 0, 'S', array of limit]

// limit added
['L', 0, '+', limit]

// limit modified
['L', 0, 'M', limit]

// limit removed
['L', 0, '-', limit]

// failed to subscribe
['L', 0, 'Z', 2]

// unsubscribed
['L', 0, 'U', 0]
```

{% endtab %}

{% tab title="Feed update example" %}

```javascript
applyToSnapshot(prevSnapshot, feed, action, data) {
    switch (feed) {
        case 'L': {
            switch (action) {
                case 'S': {
                    return [...data]
                }
                case '+': {
                    prevSnapshot.push(data)
                    break
                }
                case 'M': {
                    for (var i in prevSnapshot) {
                        // Update limit for counterparty
                        if (prevSnapshot[i]["counterpartyId"] == data["counterpartyId"]) {
                            prevSnapshot[i] = data
                            break
                        }
                    }
                    break
                }
                case '-': {
                    for (var i in prevSnapshot) {
                        // Delete limit for counterparty
                        if (prevSnapshot[i]["counterpartyId"] == data["counterpartyId"]) {
                            prevSnapshot.splice(i, 1)
                            break
                        }
                    }
                    break
                }
            }
            break
        }
    }
    return prevSnapshot
}
```

{% endtab %}
{% endtabs %}


---

# 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://faq.finerymarkets.com/api-reference/websocket-api/feed-l-counterparty-limits.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.
