Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/pacifica-fi/docs-migrate/llms.txt

Use this file to discover all available pages before exploring further.

Trading operations let you manage orders directly over the WebSocket connection without making separate HTTP requests. Every trading operation message must carry a valid Ed25519 signature — the same signing scheme used for REST POST requests. The signature, timestamp, and account fields are mandatory on every operation. See Authentication for a full walkthrough of how to construct a valid signature.
All WebSocket trading operations require Ed25519 signing. A missing or invalid signature causes the server to reject the request immediately. The Pacifica Python SDK provides ready-to-use helpers for building and signing each message type.
Each message follows the same outer envelope: a top-level id (a UUID you choose to correlate responses) and a params object whose single key names the operation. The server echoes your id back in the response so you can match requests to replies.

Create Market Order

Places a market order for immediate execution at the best available price. Market orders are subject to a configurable slippage limit; orders that would exceed the limit are rejected rather than filled at a worse price.
To protect liquidity providers from adverse selection, all market orders are subject to an approximately 200 ms delay before matching.
Request
{
    "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"
        }
    }
}
id
string
required
Client-defined request UUID. Echoed back in the response for correlation. Example: 660065de-8f32-46ad-ba1e-83c93d3e3966.
params.create_market_order.account
string
required
User’s wallet address. Example: 42trU9A5....
params.create_market_order.agent_wallet
string
Agent wallet address, if submitting on behalf of an account via an agent. Example: 69trU9A5....
params.create_market_order.signature
string
required
Ed25519 cryptographic signature of the request payload. Example: 5j1Vy9Uq....
params.create_market_order.timestamp
integer
required
Current Unix timestamp in milliseconds at the time of signing. Example: 1716200000000.
params.create_market_order.expiry_window
integer
Signature validity window in milliseconds after timestamp. Requests arriving outside this window are rejected. Example: 30000.
params.create_market_order.symbol
string
required
Trading pair symbol. Example: BTC.
params.create_market_order.reduce_only
boolean
required
When true, the order will only reduce an existing position and will be rejected if no position exists.
params.create_market_order.amount
string
required
Order size in base token units. Example: "0.001".
params.create_market_order.side
string
required
Order side: "bid" (buy / long) or "ask" (sell / short).
params.create_market_order.slippage_percent
string
required
Maximum acceptable slippage as a percentage. "0.5" means the order will not fill if the price moves more than 0.5% from the mark price.
params.create_market_order.client_order_id
string
Client-defined order UUID for tracking. Example: 79f948fd-7556-4066-a128-083f3ea49322.
params.create_market_order.builder_code
string
Builder program referral code. 3–16 alphanumeric characters. Example: MYCODE.
params.create_market_order.take_profit
object
Optional take-profit stop order to attach to this position. Contains:
  • stop_price (string, required) — Trigger price.
  • limit_price (string, optional) — Limit fill price for the triggered order.
  • client_order_id (string, optional) — UUID for the stop order.
  • trigger_price_type (string, optional)mark_price (default), last_trade_price, or mid_price.
params.create_market_order.stop_loss
object
Optional stop-loss order to attach to this position. Contains:
  • stop_price (string, required) — Trigger price.
  • limit_price (string, optional) — Limit fill price for the triggered order.
  • client_order_id (string, optional) — UUID for the stop order.
  • trigger_price_type (string, optional)mark_price (default), last_trade_price, or mid_price.
Response
{
    "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"
}
code
integer
HTTP-style status code. 200 indicates success.
data.I
string
Client order ID (client_order_id), if provided in the request.
data.i
integer
Exchange-assigned order ID.
data.s
string
Symbol.
id
string
Echoes the id from your request.
t
integer
Server timestamp in milliseconds.
type
string
Operation type: "create_market_order".

Create Limit Order

Places a limit order on the order book at a specified price. Supports all standard time-in-force options.
GTC and IOC limit orders are subject to an approximately 200 ms delay before matching to protect liquidity providers from adverse selection.
Request
{
    "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
    "params": {
        "create_order": {
            "account": "AwX6321...",
            "signature": "5vnYpt...",
            "timestamp": 1749223025396,
            "expiry_window": 5000,
            "symbol": "BTC",
            "price": "100000.00",
            "reduce_only": false,
            "amount": "0.001",
            "side": "bid",
            "tif": "GTC",
            "client_order_id": "79f948fd-7556-4066-a128-083f3ea49322",
            "builder_code": "MYCODE"
        }
    }
}
id
string
required
Client-defined request UUID. Echoed back in the response for correlation.
params.create_order.account
string
required
User’s wallet address.
params.create_order.agent_wallet
string
Agent wallet address, if submitting via an agent.
params.create_order.signature
string
required
Ed25519 cryptographic signature of the request payload.
params.create_order.timestamp
integer
required
Current Unix timestamp in milliseconds at the time of signing.
params.create_order.expiry_window
integer
Signature validity window in milliseconds after timestamp.
params.create_order.symbol
string
required
Trading pair symbol. Example: BTC.
params.create_order.price
string
required
Limit price. Example: "100000.00".
params.create_order.reduce_only
boolean
required
When true, the order will only reduce an existing position.
params.create_order.amount
string
required
Order size in base token units. Example: "0.001".
params.create_order.side
string
required
Order side: "bid" (buy / long) or "ask" (sell / short).
params.create_order.tif
string
required
Time-in-force instruction:
  • GTC — Good Till Cancelled
  • IOC — Immediate or Cancel
  • ALO — Add Liquidity Only (post-only)
  • TOB — Top of Book
params.create_order.client_order_id
string
Client-defined order UUID for tracking.
params.create_order.builder_code
string
Builder program referral code. 3–16 alphanumeric characters.
params.create_order.take_profit
object
Optional take-profit stop order to attach. Contains:
  • stop_price (string, required) — Trigger price.
  • limit_price (string, optional) — Limit fill price for the triggered order.
  • client_order_id (string, optional) — UUID for the stop order.
  • trigger_price_type (string, optional)mark_price (default), last_trade_price, or mid_price.
params.create_order.stop_loss
object
Optional stop-loss order to attach. Contains:
  • stop_price (string, required) — Trigger price.
  • limit_price (string, optional) — Limit fill price for the triggered order.
  • client_order_id (string, optional) — UUID for the stop order.
  • trigger_price_type (string, optional)mark_price (default), last_trade_price, or mid_price.
Response
{
    "code": 200,
    "data": {
        "I": "79f948fd-7556-4066-a128-083f3ea49322",
        "i": 645953,
        "s": "BTC"
    },
    "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
    "t": 1749223025962,
    "type": "create_order"
}
code
integer
HTTP-style status code. 200 indicates success.
data.I
string
Client order ID, if provided in the request.
data.i
integer
Exchange-assigned order ID.
data.s
string
Symbol.
id
string
Echoes the id from your request.
t
integer
Server timestamp in milliseconds.
type
string
Operation type: "create_order".

Edit Order

Modifies the price and/or amount of an existing open order in a single request. Identify the order to edit by providing either its exchange-assigned order_id or your client_order_id.
Editing an order cancels the original and creates a replacement. The new order retains the same side, reduce-only flag, and client order ID (if the original had one), but receives a new system-assigned order ID and is placed with TIF = ALO (post-only). Edit operations are not subject to the taker speed bump.
Request
{
    "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
    "params": {
        "edit_order": {
            "account": "AwX6321...",
            "signature": "5vnYpt...",
            "timestamp": 1749223025396,
            "expiry_window": 5000,
            "symbol": "BTC",
            "price": "99500",
            "amount": "0.002",
            "order_id": 645953
        }
    }
}
id
string
required
Client-defined request UUID. Echoed back in the response.
params.edit_order.account
string
required
User’s wallet address.
params.edit_order.agent_wallet
string
Agent wallet address, if submitting via an agent.
params.edit_order.signature
string
required
Ed25519 cryptographic signature of the request payload.
params.edit_order.timestamp
integer
required
Current Unix timestamp in milliseconds at the time of signing.
params.edit_order.expiry_window
integer
Signature validity window in milliseconds after timestamp.
params.edit_order.symbol
string
required
Trading pair symbol. Example: BTC.
params.edit_order.price
string
required
New limit price for the replacement order. Example: "99500".
params.edit_order.amount
string
required
New order size in base token units. Example: "0.002".
params.edit_order.order_id
integer
Exchange-assigned order ID of the order to edit. Required if client_order_id is not provided.
params.edit_order.client_order_id
string
Client-defined order UUID of the order to edit. Required if order_id is not provided.
Response
{
    "code": 200,
    "data": {
        "I": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
        "i": 645954,
        "s": "BTC"
    },
    "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
    "t": 1749223026150,
    "type": "edit_order"
}
code
integer
HTTP-style status code. 200 indicates success.
data.I
string
Client order ID, if the original order had one.
data.i
integer
New exchange-assigned order ID for the replacement order.
data.s
string
Symbol.
id
string
Echoes the id from your request.
t
integer
Server timestamp in milliseconds.
type
string
Operation type: "edit_order".

Batch Orders

Submits multiple order operations in a single WebSocket message. Each action in the batch is individually signed and executed atomically in the order provided — if one action fails, subsequent actions are still attempted. The batch supports up to 10 actions per request. Each action has a type that maps to the corresponding standalone operation, and a data object with the same fields as that operation’s individual message. Speed bump behaviour: A randomised 50–100 ms delay is applied to the entire batch if it contains any market orders (CreateMarket) or limit orders with TIF = GTC or IOC. The delay is not applied when the batch contains only ALO/TOB limit orders, cancel operations, or TP/SL operations. Request
{
    "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
    "params": {
        "batch_orders": {
            "actions": [
                {
                    "type": "Create",
                    "data": {
                        "account": "42trU9A5...",
                        "signature": "5UpRZ14Q...",
                        "timestamp": 1749190500355,
                        "expiry_window": 5000,
                        "symbol": "BTC",
                        "price": "100000",
                        "reduce_only": false,
                        "amount": "0.1",
                        "side": "bid",
                        "tif": "GTC",
                        "client_order_id": "57a5efb1-bb96-49a5-8bfd-f25d5f22bc7e"
                    }
                },
                {
                    "type": "CreateMarket",
                    "data": {
                        "account": "42trU9A5...",
                        "signature": "3KxMn7pQ...",
                        "timestamp": 1749190500355,
                        "expiry_window": 5000,
                        "symbol": "ETH",
                        "amount": "1.0",
                        "side": "ask",
                        "slippage_percent": "0.5",
                        "reduce_only": false
                    }
                },
                {
                    "type": "Cancel",
                    "data": {
                        "account": "42trU9A5...",
                        "signature": "4NDFHyTG...",
                        "timestamp": 1749190500355,
                        "expiry_window": 5000,
                        "symbol": "SOL",
                        "order_id": 42069
                    }
                }
            ]
        }
    }
}
id
string
required
Client-defined request UUID. Echoed back in the response.
params.batch_orders.actions
array
required
Array of up to 10 action objects. Each must contain:
  • type (string, required) — Action type (case-sensitive). One of: Create, CreateMarket, Cancel, Edit, SetPositionTpsl, CancelStopOrder.
  • data (object, required) — Signed payload for the action. Fields are identical to the corresponding standalone operation.
Response (success)
{
    "code": 200,
    "data": {
        "results": [
            {
                "success": true,
                "order_id": 645953,
                "client_order_id": "57a5efb1-bb96-49a5-8bfd-f25d5f22bc7e",
                "symbol": "BTC"
            },
            {
                "success": true,
                "order_id": 645954,
                "symbol": "ETH"
            }
        ]
    },
    "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
    "t": 1749223025962,
    "type": "batch_orders"
}
Response (bad request)
{
    "error": "Invalid batch operation parameters",
    "code": 400
}
code
integer
HTTP-style status code. 200 = success, 400 = bad request, 500 = internal error.
data.results
array
Per-action result objects. Each contains:
  • success (boolean) — Whether the individual action succeeded.
  • order_id (integer) — Exchange-assigned order ID (for create/edit actions).
  • client_order_id (string) — Client order ID, if provided.
  • symbol (string) — Symbol for the action.
id
string
Echoes the id from your request.
t
integer
Server timestamp in milliseconds.
type
string
Operation type: "batch_orders".

Cancel Order

Cancels a single open order. Identify the order to cancel by providing either its exchange-assigned order_id or your client_order_id. Cancel requests are not subject to any speed bump. Request
{
    "id": "1bb2b72f-f545-4938-8a38-c5cda8823675",
    "params": {
        "cancel_order": {
            "account": "AwX6321...",
            "signature": "4RqbgB...",
            "timestamp": 1749223343149,
            "expiry_window": 5000,
            "symbol": "BTC",
            "client_order_id": "79f948fd-7556-4066-a128-083f3ea49322"
        }
    }
}
id
string
required
Client-defined request UUID. Echoed back in the response.
params.cancel_order.account
string
required
User’s wallet address.
params.cancel_order.agent_wallet
string
Agent wallet address, if submitting via an agent.
params.cancel_order.signature
string
required
Ed25519 cryptographic signature of the request payload.
params.cancel_order.timestamp
integer
required
Current Unix timestamp in milliseconds at the time of signing.
params.cancel_order.expiry_window
integer
Signature validity window in milliseconds after timestamp.
params.cancel_order.symbol
string
required
Trading pair symbol. Example: BTC.
params.cancel_order.order_id
integer
Exchange-assigned order ID. Required if client_order_id is not provided.
params.cancel_order.client_order_id
string
Client-defined order UUID. Required if order_id is not provided.
Response
{
    "code": 200,
    "data": {
        "I": "79f948fd-7556-4066-a128-083f3ea49322",
        "i": null,
        "s": "BTC"
    },
    "id": "1bb2b72f-f545-4938-8a38-c5cda8823675",
    "t": 1749223343610,
    "type": "cancel_order"
}
code
integer
HTTP-style status code. 200 indicates success.
data.I
string
Client order ID, if provided in the request.
data.i
integer
Exchange order ID, or null.
data.s
string
Symbol.
id
string
Echoes the id from your request.
t
integer
Server timestamp in milliseconds.
type
string
Operation type: "cancel_order".

Cancel All Orders

Cancels all open orders for an account in a single request. You can cancel across all symbols at once or restrict the cancellation to a specific symbol. Optionally exclude reduce-only orders from being cancelled. Cancel operations are not subject to any speed bump. Request
{
    "id": "4e9b4edb-b123-4759-9250-d19db61fabcb",
    "params": {
        "cancel_all_orders": {
            "account": "AwX6f3...",
            "signature": "2XP8fz...",
            "timestamp": 1749221927343,
            "expiry_window": 5000,
            "all_symbols": true,
            "exclude_reduce_only": false
        }
    }
}
id
string
required
Client-defined request UUID. Echoed back in the response.
params.cancel_all_orders.account
string
required
User’s wallet address.
params.cancel_all_orders.agent_wallet
string
Agent wallet address, if submitting via an agent.
params.cancel_all_orders.signature
string
required
Ed25519 cryptographic signature of the request payload.
params.cancel_all_orders.timestamp
integer
required
Current Unix timestamp in milliseconds at the time of signing.
params.cancel_all_orders.expiry_window
integer
Signature validity window in milliseconds after timestamp.
params.cancel_all_orders.all_symbols
boolean
required
Set true to cancel orders across all markets. Set false and provide symbol to restrict cancellation to one market.
params.cancel_all_orders.exclude_reduce_only
boolean
required
Set true to preserve reduce-only orders during the bulk cancel.
params.cancel_all_orders.symbol
string
Trading pair symbol to restrict cancellation to. Required when all_symbols is false. Example: BTC.
Response
{
    "code": 200,
    "data": {
        "cancelled_count": 10
    },
    "id": "b86b4f45-49da-4191-84e2-93e141acdeab",
    "t": 1749221787291,
    "type": "cancel_all_orders"
}
code
integer
HTTP-style status code. 200 indicates success.
data.cancelled_count
integer
Number of orders successfully cancelled.
id
string
Echoes the id from your request.
t
integer
Server timestamp in milliseconds.
type
string
Operation type: "cancel_all_orders".

Build docs developers (and LLMs) love