> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pacifica.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Market Order

> This request type allows users to place market orders through Pacifica's websocket API.

The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/ws/create_order.py) provides a comprehensive example on using this endpoint.

### Request

```json theme={null}
{
  "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
  "params": {
    "create_market_order": {
      "account": "AwX6321...",
      "signature": "5vnYpt...",
      "timestamp": 1749223025396,
      "expiry_window": 5000,
      "symbol": "BTC",
      "reduce_only": false,
      "amount": "0.001",
      "side": "bid",
      "slippage_percent": "0.5",
      "client_order_id": "79f948fd-7556-4066-a128-083f3ea49322",
      "builder_code": "MYCODE"
    }
  }
}
```

<table><thead><tr><th width="194">Field</th><th width="98">Type</th><th width="95">Need</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><code>"id"</code></td><td>Full UUID string</td><td>required</td><td>Client-defined request ID</td><td><code>660065de-8f32-46ad-ba1e-83c93d3e3966</code></td></tr><tr><td><code>"params"</code></td><td>object</td><td>required</td><td>Contains action type and action parameters</td><td><code>"create\_order"</code></td></tr><tr><td><code>"create\_market\_order"</code></td><td>object</td><td>required</td><td>Specifies action type and contains parameters</td><td>See examples.</td></tr><tr><td><code>"account"</code></td><td>string</td><td>required</td><td>User's wallet address</td><td><code>42trU9A5...</code></td></tr><tr><td><code>"agent\_wallet"</code></td><td>string</td><td>optional</td><td>Agent wallet address</td><td><code>69trU9A5...</code></td></tr><tr><td><code>"signature"</code></td><td>string</td><td>required</td><td>Cryptographic signature</td><td><code>5j1Vy9Uq...</code></td></tr><tr><td><code>"timestamp"</code></td><td>integer</td><td>required</td><td>Current timestamp in milliseconds</td><td><code>1716200000000</code></td></tr><tr><td><code>"expiry\_window"</code></td><td>integer</td><td>optional</td><td>Signature expiry in milliseconds</td><td><code>30000</code></td></tr><tr><td><code>"symbol"</code></td><td>string</td><td>required</td><td>Trading pair symbol</td><td><code>BTC</code></td></tr><tr><td><code>"reduce\_only"</code></td><td>boolean</td><td>required</td><td>Whether the order is reduce-only</td><td><code>false</code></td></tr><tr><td><code>"amount"</code></td><td>string</td><td>required</td><td>Order amount</td><td><code>0.1</code></td></tr><tr><td><code>"side"</code></td><td>string</td><td>required</td><td>Order side (bid/ask)</td><td><code>bid</code></td></tr><tr><td><code>"slippage\_percent"</code></td><td>string</td><td>required</td><td>Maximum allowed slippage in percentage, e.g. "0.5" means 0.5% max slippage</td><td><code>0.5</code></td></tr><tr><td><code>"client\_order\_id"</code></td><td>Full UUID string</td><td>optional</td><td>Client-defined order ID</td><td><code>f47ac10b-58cc-4372-a567-0e02b2c3d479</code></td></tr><tr><td><code>"builder\_code"</code></td><td>string</td><td>optional</td><td>Builder program code (3-16 alphanumeric)</td><td><code>MYCODE</code></td></tr><tr><td><code>"take\_profit"</code></td><td>object</td><td>optional</td><td>Take profit stop order configuration</td><td>See next three rows</td></tr><tr><td><code>"stop\_price"</code></td><td>string</td><td>required (if <code>"take\_profit"</code> exists)</td><td>Stop trigger price</td><td><code>55000</code></td></tr><tr><td><code>"limit\_price"</code></td><td>string</td><td>optional</td><td>Limit price for the triggered order</td><td><code>54950</code></td></tr><tr><td><code>"client\_order\_id"</code></td><td>Full UUID string</td><td>optional</td><td>Client-defined order ID for the stop order</td><td><code>e36ac10b-58cc-4372-a567-0e02b2c3d479</code></td></tr><tr><td><code>"trigger\_price\_type"</code></td><td>string</td><td>optional</td><td>Price type to trigger stop. Options: <code>mark\_price</code> (default), <code>last\_trade\_price</code>, <code>mid\_price</code></td><td><code>mark\_price</code></td></tr><tr><td><code>"stop\_loss"</code></td><td>object</td><td>optional</td><td>Stop loss order configuration</td><td>See next three rows</td></tr><tr><td><code>"stop\_price"</code></td><td>string</td><td>required (if <code>"stop\_loss"</code> exists)</td><td>Stop trigger price</td><td><code>48000</code></td></tr><tr><td><code>"limit\_price"</code></td><td>string</td><td>optional</td><td>Limit price for the triggered order</td><td><code>47950</code></td></tr><tr><td><code>"client\_order\_id"</code></td><td>Full UUID string</td><td>optional</td><td>Client-defined order ID for the stop order</td><td><code>d25ac10b-58cc-4372-a567-0e02b2c3d479</code></td></tr><tr><td><code>"trigger\_price\_type"</code></td><td>string</td><td>optional</td><td>Price type to trigger stop. Options: <code>mark\_price</code> (default), <code>last\_trade\_price</code>, <code>mid\_price</code></td><td><code>mark\_price</code></td></tr></tbody></table>

### Response

```json theme={null}
{
  "code": 200,
  "data": {
    "I": "79f948fd-7556-4066-a128-083f3ea49322",
    "i": 645953,
    "s": "BTC"
  },
  "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
  "t": 1749223025962,
  "type": "create_market_order",
  "rl": {
    "r": 9990,
    "q": 10000,
    "t": 1000
  }
}
```

| Field    | Type           | Description                                                                                |
| -------- | -------------- | ------------------------------------------------------------------------------------------ |
| `'code'` | integer        | Status code                                                                                |
| `'data'` | object         | Contains information about placed order                                                    |
| `'I'`    | string         | CLOID (if provided)                                                                        |
| `'i'`    | integer        | Order ID                                                                                   |
| `'s'`    | string         | Symbol                                                                                     |
| `'id'`   | string         | Client-defined request ID                                                                  |
| `'t'`    | integer        | Timestamp in milliseconds                                                                  |
| `'type'` | string         | Specifies action type                                                                      |
| `'rl'`   | object or null | Rate-limit info, always present: `r` = credits remaining, `q` = quota, `t` = reset-in (ms) |

On error, the frame omits `data` and instead carries an `err` (string) field describing the failure, alongside the same `id`, `type`, `code`, `t`, and `rl` fields.

Note: In order to protect liquidity providers from adverse selection, all market orders are subject to a \~200ms delay.
