# Trading for LPs and Masters

## Submitting new orders

### NewOrderSingle: <mark style="background-color:green;">Successful submission of the new order</mark>

<table><thead><tr><th width="121">Msg Num</th><th>Message</th><th width="148">ExecType&#x3C;150></th><th width="158">OrdStatus&#x3C;39></th><th width="146">OrderQty&#x3C;38></th><th width="153">LeavesQty&#x3C;151></th><th width="143">Description</th></tr></thead><tbody><tr><td>1</td><td>NewOrderSingle&#x3C;D></td><td>-</td><td>-</td><td>0.1</td><td>-</td><td>LP sends an order</td></tr><tr><td>2</td><td>ExecutionReport&#x3C;8></td><td>0(New)</td><td>0(New)</td><td>0.1</td><td>0.1</td><td>Order accepted</td></tr></tbody></table>

<details>

<summary>Example of the messages</summary>

{% code overflow="wrap" lineNumbers="true" %}

```
8=FIX.4.4|9=183|35=D|34=2|49=<api_key>|52=20240508-14:06:38.019|56=FINERYMARKETS|11=1|38=10000000|40=2|44=300000000000|54=1|55=BTC-USD|59=1|60=20240508-14:06:37.769|10=066|
8=FIX.4.4|9=182|35=8|34=2|49=FINERYMARKETS|52=20240508-14:06:38.020|56=<api_key>|11=1|17=1|37=1|38=10000000|39=0|44=300000000000|54=1|55=BTC-USD|150=0|151=10000000|10=125|
```

{% endcode %}

</details>

### NewOrderSingle: <mark style="background-color:red;">Rejection during submission of the new order</mark>

<table><thead><tr><th width="121">Msg Num</th><th width="116">Message</th><th width="154">ExecType&#x3C;150></th><th width="153">OrdStatus&#x3C;39></th><th width="144">OrderQty&#x3C;38></th><th width="156">LeavesQty&#x3C;151></th><th>Description</th></tr></thead><tbody><tr><td>1</td><td>NewOrderSingle&#x3C;D></td><td>-</td><td>-</td><td>0.1</td><td>-</td><td>LP sends an order</td></tr><tr><td>2</td><td>ExecutionReport&#x3C;8></td><td>8(Rejected)</td><td>8(Rejected)</td><td>0.1</td><td>0</td><td>Order rejected with the reason, provided in the Text&#x3C;58></td></tr></tbody></table>

<details>

<summary>Example of the messages</summary>

{% code overflow="wrap" lineNumbers="true" %}

```
8=FIX.4.4|9=202|35=D|34=3|49=<api_key>|52=20240508-14:23:42.858|56=FINERYMARKETS|11=41667222189341000857|38=10000000|40=2|44=300000000000|54=1|55=BTC-USD|59=1|60=20240508-14:23:42.663|10=057|
8=FIX.4.4|9=246|35=8|34=3|49=FINERYMARKETS|52=20240508-14:23:42.859|56=<api_key>|11=41667222189341000857|37=0|38=10000000|39=8|44=300000000000|54=1|55=BTC-USD|58=Invalid clOrdId. Should be unsigned 64-bit number > 0|150=8|151=0|10=026|
```

{% endcode %}

</details>

## Cancelation of the Orders

### CancelOrder: <mark style="background-color:green;">Success</mark>

<table><thead><tr><th width="121">Msg Num</th><th width="138">Message</th><th width="154">ExecType&#x3C;150></th><th width="149">OrdStatus&#x3C;39></th><th width="147">OrderQty&#x3C;38></th><th width="156">LeavesQty&#x3C;151></th><th width="130">Description</th></tr></thead><tbody><tr><td>1</td><td>NewOrderSingle&#x3C;D></td><td>-</td><td>-</td><td>0.1</td><td>-</td><td>LP sends an order</td></tr><tr><td>2</td><td>ExecutionReport&#x3C;8></td><td>0(New)</td><td>0(New)</td><td>0.1</td><td>0.1</td><td>Order accepted</td></tr><tr><td>3</td><td>OrderCancelRequest&#x3C;F></td><td>-</td><td>-</td><td>-</td><td>-</td><td>LP cancels the order</td></tr><tr><td>4</td><td>ExecutionReport&#x3C;8></td><td>4(Cancel)</td><td>4(Cancelled)</td><td>0.1</td><td>0.1</td><td>Order cancelled and no longer exists in the order book</td></tr></tbody></table>

<details>

<summary>Example of the messages</summary>

{% code overflow="wrap" lineNumbers="true" %}

```
8=FIX.4.4|9=183|35=D|34=3|49=<api_key>|52=20240508-14:26:50.359|56=FINERYMARKETS|11=1|38=10000000|40=2|44=300000000000|54=1|55=BTC-USD|59=1|60=20240508-14:26:50.143|10=028|
8=FIX.4.4|9=182|35=8|34=3|49=FINERYMARKETS|52=20240508-14:26:50.360|56=<api_key>|11=1|17=1|37=1|38=10000000|39=0|44=300000000000|54=1|55=BTC-USD|150=0|151=10000000|10=104|
8=FIX.4.4|9=185|35=F|34=4|49=<api_key>|52=20240508-14:26:50.360|56=FINERYMARKETS|11=1|41=1|54=1|55=BTC-USD|60=20240508-14:26:50.143|10=010|
8=FIX.4.4|9=182|35=8|34=4|49=FINERYMARKETS|52=20240508-14:26:50.360|56=<api_key>|11=1|17=1|37=1|38=10000000|39=4|44=300000000000|54=1|55=BTC-USD|150=4|151=10000000|10=113|
```

{% endcode %}

</details>

### CancelOrder: <mark style="background-color:red;">Reject</mark>

| 1 | OrderCancelRequest\<F>             | LP tries to cancel non-existing order      |
| - | ---------------------------------- | ------------------------------------------ |
| 2 | <p>OrderCancelReject</p><p><9></p> | Rejected with an FM error code in Text<58> |

<details>

<summary>Example of the messages</summary>

{% code overflow="wrap" lineNumbers="true" %}

```
8=FIX.4.4|9=150|35=F|34=2|49=<api_key>|52=20240508-14:34:35.941|56=FINERYMARKETS|11=1|41=1|54=1|55=BTC-USD|60=20240508-14:34:35.737|10=162|
8=FIX.4.4|9=133|35=9|34=2|49=FINERYMARKETS|52=20240508-14:34:35.941|56=<api_key>|11=1|39=0|41=1|58=80|102=99|434=1|10=129|
```

{% endcode %}

</details>

## Modification of the Orders

### Cancel/Replace Order: <mark style="background-color:green;">Replace New Order</mark>

<table><thead><tr><th width="140">Msg Num</th><th width="137">Message</th><th width="160">ExecType&#x3C;150></th><th width="152">OrdStatus&#x3C;39></th><th width="157">OrderQty&#x3C;38></th><th width="160">LeavesQty&#x3C;151></th><th width="157">Description</th></tr></thead><tbody><tr><td>1</td><td>NewOrderSingle&#x3C;D></td><td>-</td><td>-</td><td>0.1</td><td>-</td><td>LP sends an order</td></tr><tr><td>2</td><td>ExecutionReport&#x3C;8></td><td>0(New)</td><td>0(New)</td><td>0.1</td><td>0.1</td><td>Order accepted</td></tr><tr><td>3</td><td>OrderCancel/ReplaceRequest&#x3C;G></td><td>-</td><td>-</td><td>0.1</td><td>-</td><td>LP requests to replace the order</td></tr><tr><td>4</td><td>ExecutionReport&#x3C;8></td><td>5(Replace)</td><td>0(New)</td><td>0.1</td><td>0.1</td><td>Order replaced, new order created, new OrderID&#x3C;37> assigned</td></tr></tbody></table>

<details>

<summary>Examples of the messages</summary>

{% code overflow="wrap" lineNumbers="true" %}

```
8=FIX.4.4|9=183|35=D|34=3|49=<api_key>|52=20240508-14:43:58.276|56=FINERYMARKETS|11=1|38=10000000|40=2|44=300000000000|54=1|55=BTC-USD|59=1|60=20240508-14:43:58.084|10=034|
8=FIX.4.4|9=182|35=8|34=3|49=FINERYMARKETS|52=20240508-14:43:58.277|56=<api_key>|11=1|17=1|37=1|38=10000000|39=0|44=300000000000|54=1|55=BTC-USD|150=0|151=10000000|10=108|
8=FIX.4.4|9=184|35=G|34=4|49=<api_key>|52=20240508-14:43:58.277|56=FINERYMARKETS|11=42|37=1|38=10000000|40=2|41=1|44=350000000000|54=1|55=BTC-USD|60=20240508-14:43:58.084|10=094|
8=FIX.4.4|9=188|35=8|34=4|49=FINERYMARKETS|52=20240508-14:43:58.278|56=<api_key>|11=42|17=2|37=2|38=10000000|39=0|41=1|44=350000000000|54=1|55=BTC-USD|150=5|151=10000000|10=137|
```

{% endcode %}

</details>

### Cancel/Replace Order: <mark style="background-color:green;">Replace Partially Filled Order</mark>

<table><thead><tr><th width="121">Msg Num</th><th width="106">Message</th><th width="155">ExecType&#x3C;150></th><th width="157">OrdStatus&#x3C;39></th><th width="134">OrderQty&#x3C;38></th><th width="154">LeavesQty&#x3C;151></th><th>Description</th></tr></thead><tbody><tr><td>1</td><td>NewOrderSingle&#x3C;D></td><td>-</td><td>-</td><td>0.2</td><td>-</td><td>LP sends an order</td></tr><tr><td>2</td><td>ExecutionReport&#x3C;8></td><td>0(New)</td><td>0(New)</td><td>0.2</td><td>0.2</td><td>Order accepted</td></tr><tr><td>3</td><td>ExecutionReport&#x3C;8></td><td>F(Trade)</td><td>1(Partially filled)</td><td>0.2</td><td>0.1</td><td>Trade happened, the order is partially filled</td></tr><tr><td>4</td><td>OrderCancel/ReplaceRequest&#x3C;G></td><td>-</td><td>-</td><td>0.2</td><td>-</td><td>LP requests to replace the order</td></tr><tr><td>5</td><td>ExecutionReport&#x3C;8></td><td>5(Replace)</td><td>0(New)</td><td>0.1</td><td>0.1</td><td>Order replaced, new order created, <strong>new OrderID&#x3C;37> assigned</strong></td></tr></tbody></table>

<details>

<summary>Examples of the messages</summary>

{% code overflow="wrap" lineNumbers="true" %}

```
8=FIX.4.4|9=183|35=D|34=2|49=<api_key>|52=20240508-14:53:40.580|56=FINERYMARKETS|11=1|38=20000000|40=2|44=300000000000|54=1|55=BTC-USD|59=1|60=20240508-14:53:40.380|10=092| 
8=FIX.4.4|9=182|35=8|34=2|49=FINERYMARKETS|52=20240508-14:53:40.581|56=<api_key>|11=1|17=1|37=1|38=20000000|39=0|44=300000000000|54=1|55=BTC-USD|150=0|151=20000000|10=176| 
8=FIX.4.4|9=259|35=8|34=3|49=FINERYMARKETS|52=20240508-14:53:40.633|56=<api_key>|11=1|17=1|31=300000000000|32=10000000|37=1|38=20000000|39=1|44=300000000000|54=1|55=BTC-USD|60=20240508-14:53:40.632|136=1|137=0|139=8|150=F|151=10000000|958=2|10=226| 
8=FIX.4.4|9=184|35=G|34=3|49=<api_key>|52=20240508-14:53:40.634|56=FINERYMARKETS|11=42|37=1|38=20000000|40=2|41=1|44=350000000000|54=1|55=BTC-USD|60=20240508-14:53:40.380|10=151| 
8=FIX.4.4|9=188|35=8|34=4|49=FINERYMARKETS|52=20240508-14:53:40.634|56=<api_key>|11=42|17=3|37=3|38=10000000|39=0|41=1|44=350000000000|54=1|55=BTC-USD|150=5|151=10000000|10=204|
```

{% endcode %}

</details>

{% hint style="warning" %}
Pay close attention to Message #5\
Replacing a partially filled order the size of a newly replaced order will be less than the specified size by the filled amount (e.g., the size of an initial order was 10; then the order was partially filled and the remaining size was 8; when a user replaces this order, a new size must be 12 if a user wants to have 10 in the order book).
{% endhint %}

### Cancel/Replace Order: <mark style="background-color:red;">The old order had been cancelled but the new one wasn't added</mark>

| Msg Num | Message                        | ExecType<150> | OrdStatus<39> | OrderQty<38> | LeavesQty<151> | Description                                                                   |
| ------- | ------------------------------ | ------------- | ------------- | ------------ | -------------- | ----------------------------------------------------------------------------- |
| 1       | NewOrderSingle\<D>             | -             | -             | 0.2          | -              | LP sends an order                                                             |
| 2       | ExecutionReport<8>             | 0(New)        | 0(New)        | 0.2          | 0.2            | Order accepted                                                                |
| 3       | OrderCancel/ReplaceRequest\<G> | -             | -             | 0.2          | -              | LP requests to replace the order                                              |
| 4       | ExecutionReport<8>             | 5(Replace)    | 4(Cancelled)  | 0.2          | 0.2            | Order cancelled, but the new order was not created, FM error code in Text<58> |

<details>

<summary>Examples of the messages</summary>

{% code overflow="wrap" lineNumbers="true" %}

```
8=FIX.4.4|9=183|35=D|34=3|49=<api_key>|52=20240508-14:58:50.131|56=FINERYMARKETS|11=2|38=20000000|40=2|44=300000000000|54=1|55=BTC-USD|59=1|60=20240508-14:58:49.216|10=014|
8=FIX.4.4|9=182|35=8|34=3|49=FINERYMARKETS|52=20240508-14:58:50.131|56=<api_key>|11=2|17=2|37=2|38=20000000|39=0|44=300000000000|54=1|55=BTC-USD|150=0|151=20000000|10=087|
8=FIX.4.4|9=183|35=G|34=4|49=<api_key>|52=20240508-14:58:50.132|56=FINERYMARKETS|11=1|37=2|38=20000000|40=2|41=2|44=350000000000|54=1|55=BTC-USD|60=20240508-14:58:49.216|10=020|
8=FIX.4.4|9=188|35=8|34=4|49=FINERYMARKETS|52=20240508-14:58:50.132|56=<api_key>|11=2|17=2|37=2|38=20000000|39=4|41=2|44=300000000000|54=1|55=BTC-USD|58=74|150=5|151=20000000|10=126|
```

{% endcode %}

</details>

{% hint style="info" %}
Previously Finery Markets sent 2 messages, now only 1 with a cancelation notification and an error code (Message #4)
{% endhint %}

### Cancel/Replace Order: <mark style="background-color:red;">Rejection</mark>

| Msg Num | Message                            | Description                              |
| ------- | ---------------------------------- | ---------------------------------------- |
| 1       | OrderCancel/ReplaceRequest\<G>     | LP tries to replace a non-existing order |
| 2       | <p>OrderCancelReject</p><p><9></p> | Reject, FM error code in Text<58>        |

<details>

<summary>Examples of the messages</summary>

{% code overflow="wrap" lineNumbers="true" %}

```
8=FIX.4.4|9=183|35=G|34=2|49=UEY0pblIVyfEYFClzjIyoIhN0zog1vewjQnTO2qKulp|52=20240508-15:19:20.280|56=FINERYMARKETS|11=1|37=1|38=20000000|40=2|44=299900000000|54=1|55=BTC-USD|60=20240508-15:19:20.070|10=136|
8=FIX.4.4|9=133|35=9|34=2|49=FINERYMARKETS|52=20240508-15:19:20.280|56=UEY0pblIVyfEYFClzjIyoIhN0zog1vewjQnTO2qKulp|11=1|37=1|39=0|41=1|58=80|102=99|434=2|10=107|
```

{% endcode %}

</details>

## Results of Taker's Trading

### Order <mark style="background-color:yellow;">partially Filled</mark>

<table><thead><tr><th width="120">Msg Num</th><th width="108">Message</th><th width="153">ExecType&#x3C;150></th><th width="152">OrdStatus&#x3C;39></th><th width="144">OrderQty&#x3C;38></th><th width="158">LeavesQty&#x3C;151></th><th width="153">Description</th></tr></thead><tbody><tr><td>1</td><td>NewOrderSingle&#x3C;D></td><td>-</td><td>-</td><td>0.2</td><td>-</td><td>LP sends an order</td></tr><tr><td>2</td><td>ExecutionReport&#x3C;8></td><td>0(New)</td><td>0(New)</td><td>0.2</td><td>0.2</td><td>Order accepted</td></tr><tr><td>3</td><td>ExecutionReport&#x3C;8></td><td>F(Trade)</td><td>1(Partially filled)</td><td>0.2</td><td>0.1</td><td>Trade happened, the order is partially filled</td></tr></tbody></table>

<details>

<summary>Examples of the messages</summary>

{% code overflow="wrap" lineNumbers="true" %}

```
8=FIX.4.4|9=183|35=D|34=2|49=<api_key>|52=20240508-14:53:40.580|56=FINERYMARKETS|11=1|38=20000000|40=2|44=300000000000|54=1|55=BTC-USD|59=1|60=20240508-14:53:40.380|10=092|
8=FIX.4.4|9=182|35=8|34=2|49=FINERYMARKETS|52=20240508-14:53:40.581|56=<api_key>|11=1|17=1|37=1|38=20000000|39=0|44=300000000000|54=1|55=BTC-USD|150=0|151=20000000|10=176|
```

{% endcode %}

</details>

### Order <mark style="background-color:green;">Filled in Full</mark><br>

<table><thead><tr><th width="121">Msg Num</th><th width="112">Message</th><th width="149">ExecType&#x3C;150></th><th width="151">OrdStatus&#x3C;39></th><th width="144">OrderQty&#x3C;38></th><th width="156">LeavesQty&#x3C;151></th><th width="144">Description</th></tr></thead><tbody><tr><td>1</td><td>NewOrderSingle&#x3C;D></td><td>-</td><td>-</td><td>0.2</td><td>-</td><td>LP sends an order</td></tr><tr><td>2</td><td>ExecutionReport&#x3C;8></td><td>0(New)</td><td>0(New)</td><td>0.2</td><td>0.2</td><td>Order accepted</td></tr><tr><td>3</td><td>ExecutionReport&#x3C;8></td><td>F(Trade)</td><td>2(Filled)</td><td>0.2</td><td>0</td><td>Trade happened, the order is filled and no longer exists in the order book</td></tr></tbody></table>

<details>

<summary>Examples of the messages</summary>

{% code overflow="wrap" lineNumbers="true" %}

```
8=FIX.4.4|9=183|35=D|34=2|49=<api_key>|52=20240508-15:29:39.362|56=FINERYMARKETS|11=1|38=10000000|40=2|44=300000000000|54=1|55=BTC-USD|59=1|60=20240508-15:29:39.140|10=084|
8=FIX.4.4|9=182|35=8|34=2|49=FINERYMARKETS|52=20240508-15:29:39.363|56=<api_key>|11=1|17=1|37=1|38=10000000|39=0|44=300000000000|54=1|55=BTC-USD|150=0|151=10000000|10=161|
8=FIX.4.4|9=252|35=8|34=3|49=FINERYMARKETS|52=20240508-15:29:39.413|56=<api_key>|11=1|17=1|31=300000000000|32=10000000|37=1|38=10000000|39=2|44=300000000000|54=1|55=BTC-USD|60=20240508-15:29:39.413|136=1|137=0|139=8|150=F|151=0|958=2|10=132|
```

{% endcode %}

</details>

{% hint style="danger" %}
If the order has been fully utilized by a Taker, you can no longer modify it
{% endhint %}


---

# 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/fix-api/trade/trading-for-lps-and-masters.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.
