# QS Trading for Liquidity Providers

## Add Event (Sent by FM to Maker)

Forwards an order to a maker for execution. The WS connection providing market data updates for the corresponding stream is used to send the event.

{% tabs %}
{% tab title="Event Schema" %}

```json
{
  "event": "add", // event type, required
  "instrument": <string>, // instrument name, required
  "clientOrderId": <string>, // client order id, required
  "price": <uint64>, // order limit price, optional
  "size": <int64>, // order size, required
  "side": <string>, // order side, required; can be "bid" or "ask"
  "type": <enum>, // order type, required; e.g., "limitFOK", "limitIOC"
  "clientId": <uint32> // FM id of an order owning client (taker), required
}
The FM sends the taker order to the Maker via the connection corresponding to the assigned stream.
```

{% endtab %}

{% tab title="Event Example" %}

```json
{
  "event": "add",
  "instrument": "BTC-USD",
  "clientOrderId": "FM-1942908188298842112",
  "price": 100000000,
  "size": 100000000,
  "side": "ask",
  "type": "limitFOK",
  "clientId": 2
}
```

{% endtab %}
{% endtabs %}

## Execution Report (Trade)

Confirms a trade execution.

{% tabs %}
{% tab title="Event Schema" %}

```json
{
  "event": "executionReport", // event type, required
  "reqId": <string>, // execution report id, required
  "executionType": "trade", // type of the report, required
  "clientOrderId": <string>, // client order id, required
  "remainingQuantity": <int64>, // quantity open for execution, required
  "dealId": <string>, // deal id, required
  "dealPrice": <uint64>, // execution price, required
  "dealSize": <int64>, // executed size, required
  "dealVolume": <int64>, // executed volume, required
  "timestamp": <int64> // timestamp of the execution report, unix ts with milliseconds, required
}
```

{% endtab %}

{% tab title="Event Example" %}

```json
{
  "event": "executionReport",
  "reqId": "6",
  "executionType": "trade",
  "clientOrderId": "FM-1942908188298842112",
  "remainingQuantity": 0,
  "dealId": "deal_id",
  "dealPrice": 200000000,
  "dealSize": 200000000,
  "dealVolume": 400000000,
  "timestamp": 1691293110524
}
```

{% endtab %}
{% endtabs %}

## Execution Report (Reject)

Rejects a trade with a reason.

{% tabs %}
{% tab title="Event Schema" %}

```json
{
  "event": "executionReport", // event type, required
  "reqId": <string>, // execution report id, required
  "executionType": "reject", // type of the report, required
  "clientOrderId": <string>, // client order id, required
  "reason": <string>, // reject reason, required
  "timestamp": <int64> // timestamp of the execution report, unix ts with milliseconds, required
}
```

{% endtab %}

{% tab title="Event Example" %}

```json
{
  "event": "executionReport",
  "reqId": "6",
  "executionType": "reject",
  "clientOrderId": "FM-1942908188298842112",
  "reason": "insufficient liquidity",
  "timestamp": 1691293110524
}
```

{% 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/qs-for-liquidity-providers/qs-trading-for-liquidity-providers.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.
