> For the complete documentation index, see [llms.txt](https://docs.aquanow.io/aquanow/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aquanow.io/aquanow/api-endpoints-or-v2.0/executions-api/trading-strategies/advanced-strategies.md).

# Advanced Strategies

## Stop Market

{% hint style="info" %}
Requirement: Stop Market orders are an advanced execution strategy. Your account must be explicitly enabled to use this feature. Please contact `support@aquanow.io` to request access.
{% endhint %}

Aquanow's Stop Market strategy creates a pending order that remains inactive until the market price reaches your specified `stopPrice`. Once triggered, the order executes immediately as a market order.

#### Trigger Logic

Stop market orders are triggered based on your account's pricing tier:

Buy Orders:

* Triggers when price is greater than or equal to: `best bid price`

Sell Orders:

* Triggers when price is greater than or equal to: `best ask price`

> Note: > \* Immediate Execution Rule: If a stop market order is immediately executable upon entry (i.e., the stop price is already met), the system will reject the order.
>
> * Quantity Constraint: Only `deliverQuantity` (deliver currency) can be specified for this strategy.

***

#### Endpoint to initiate a Stop Market request

`POST https://api.aquanow.io/trades/v2/order`

**Headers**

| x-api-key<mark style="color:$danger;">\*</mark>    | String | `{{x-api-key}}` API Auth Key                                                                                                                                       |
| -------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| x-signature<mark style="color:$danger;">\*</mark>  | String | <p><code>49c6260c194f4d7ed5cb917dc70b9821673246b2abc1cf28f05df6a75fd24181e00f8e57b321d15ae45db58b3bffe27a</code></p><p>Signature created using your API secret</p> |
| x-nonce<mark style="color:$danger;">\*</mark>      | Number | <p><code>1618307861949</code></p><p>Timestamp in milliseconds</p>                                                                                                  |
| Content-Type<mark style="color:$danger;">\*</mark> | String | `application/json`                                                                                                                                                 |

**Request Body**

| strategy<mark style="color:$danger;">\*</mark>        | String | `"STOP_MARKET"`                                                                                                                                                                                                                                                                                                                                |
| ----------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| accountId<mark style="color:$danger;">\*</mark>       | String | Identifier for account the order will be applied to.                                                                                                                                                                                                                                                                                           |
| ticker<mark style="color:$danger;">\*</mark>          | String | <p>e.g., <code>BTC-CAD</code></p><p><br></p><p>Currency pair</p>                                                                                                                                                                                                                                                                               |
| tradeSide<mark style="color:$danger;">\*</mark>       | String | `"buy"` or `"sell"`                                                                                                                                                                                                                                                                                                                            |
| stopPrice<mark style="color:$danger;">\*</mark>       | String | <p>The trigger price.</p><p><br></p><p>• If sell: Triggers when Best Ask <= <code>stopPrice</code></p><p><br></p><p>• If buy: Triggers when Best Bid >= <code>stopPrice</code></p><p><br><br></p><p><em>Note: Similar to limit orders, the specified price should be within 40% of the current price.</em></p>                                 |
| deliverQuantity<mark style="color:$danger;">\*</mark> | String | <p>Quantity of currency delivered by user based on the ticker and tradeSide.</p><p><br></p><p>For example, if ticker is <code>BTC-USD</code> and tradeSide is <code>sell</code>, the delivered currency is <code>BTC</code>.</p><p><br><br></p><p><em>Note: For Stop Market orders, only deliverQuantity is accepted.</em></p>                 |
| timeInForce<mark style="color:$danger;">\*</mark>     | String | <p>Determines how long the order remains active.</p><p><br></p><p>Accepted values:</p><p><br></p><p>• <code>GTC</code> (Default): Good Till Cancel. Active for 90 days.</p><p><br></p><p>• <code>DAY</code>: Active for 24 hours from creation.</p><p><br></p><p>• <code>GTD</code>: Good Till Date. Requires <code>expirationTime</code>.</p> |
| expirationTime                                        | Number | <p>Optional. e.g., <code>1669972404350</code></p><p><br></p><p>Expiration time in Unix milliseconds.</p><p><br></p><p>Required ONLY if <code>timeInForce</code> is <code>GTD</code>. Must be ≤ 90 days from now. Ignored if timeInForce is <code>GTC</code> or <code>DAY</code>.</p>                                                           |
| usernameRef                                           | String | A new reference string for sub-accounts. Must be less than 64 characters, cannot contain special characters.                                                                                                                                                                                                                                   |

***

#### Responses

{% tabs %}
{% tab title="200: OK - Sell Stop Market Order" %}
Returns an [OrdersV2Object](https://docs.aquanow.io/aquanow/data-objects-and-statuses/executions-objects#ordersv2object).

```json
{
    "type": "stop_marketOrderAck",
    "data": {
        "accountId": "CA1001099R",
        "orderId": "98a048db-2938-46ff-bf33-e8bdca7ee89c",
        "strategy": "STOP_MARKET",
        "timeInForce": "DAY",
        "ticker": "BTC-USD",
        "tradeSide": "sell",
        "stopPrice": "65000.00",
        "deliverCurrency": "BTC",
        "deliverQuantity": "0.10000000",
        "receiveCurrency": "USD",
        "createdAt": 1776103410342,
        "expireTime": 1776189810342,
        "tradeStatus": "AWAITING"
    }
}
```

{% endtab %}

{% tab title="200: OK - Buy Stop Market Order" %}
Returns an [OrdersV2Object](https://docs.aquanow.io/aquanow/data-objects-and-statuses/executions-objects#ordersv2object).

```json
{
    "type": "stop_marketOrderAck",
    "data": {
        "accountId": "CA1001099R",
        "orderId": "80f93a5f-ed00-4d7a-9d25-844305e62a93",
        "strategy": "STOP_MARKET",
        "timeInForce": "DAY",
        "ticker": "BTC-USD",
        "tradeSide": "buy",
        "stopPrice": "73000.00",
        "deliverCurrency": "USD",
        "deliverQuantity": "10.00",
        "receiveCurrency": "BTC",
        "createdAt": 1776103502591,
        "expireTime": 1776189902591,
        "tradeStatus": "AWAITING"
    }
}
```

{% endtab %}

{% tab title="400 Bad Request - order immediately executable" %}

```json
{
    "errors": [
        {
            "id": "d20751d4-2d19-46ef-9ae6-ef65aa690361",
            "message": "Cancelled - Stop price already reached. Place a market order instead."
        }
    ]
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid ticker" %}

```json
{
    "errors": [
        {
            "id": "fd103ff5-39ff-4fd7-84ab-3dc0f4e5292a",
            "message": "data/ticker must be equal to one of the allowed values"
        }
    ]
}
```

{% endtab %}

{% tab title="400 Bad Request - Invalid trade side" %}

```json
{
    "errors": [
        {
            "id": "fb8bf134-3e8d-42c7-8072-169280ccb56f",
            "message": "data/ticker must be equal to one of the allowed values, data/tradeSide must be equal to one of the allowed values"
        }
    ]
}
```

{% endtab %}

{% tab title="400 Bad Request - Invalid deliverQuantity" %}

```json
{
    "errors": [
        {
            "id": "6e9d876c-bbd5-4d86-9d93-0d9c70beab07",
            "message": "deliverQuantity must be a positive number"
        }
    ]
}
```

{% endtab %}

{% tab title="400 Bad Request - Invalid stopPrice" %}

```json
{
    "errors": [
        {
            "id": "f55db822-a37d-49f9-a764-76d85e72de75",
            "message": "stopPrice must be a positive number"
        }
    ]
}
```

{% endtab %}
{% endtabs %}
