Skip to main content

Pause Strategy

Halt new entries on a deployed strategy. By default, existing positions remain open and continue to be managed by the strategy's exit rules. Pass close_positions: true to flatten open positions at market before transitioning to paused.

Endpoint

POST /v1/strategies/{id}/pause

Weight: 5 Authentication: Required (signed) — see Authentication.

Request

Path parameter: id — the strategy identifier (e.g. strat_8f2a1b).

NameTypeMandatoryDescription
close_positionsbooleanNOWhen true, the engine sends market-close orders for every open position before pausing. When false (default), open positions remain in place and the engine continues to monitor exit conditions even though no new entries are taken.

Response

Returns the strategy object with status: "paused".

{
"id": "strat_8f2a1b",
"name": "BTC grid 1h",
"template_id": "tpl_grid",
"params": {
"grid_levels": 8,
"upper_price": "72000",
"lower_price": "60000",
"rebalance_threshold": "0.02"
},
"symbols": ["BTCUSDT"],
"timeframe": "1h",
"capital": "10000.00",
"leverage": 3,
"status": "paused",
"deployed_at": "2026-04-29T08:00:00Z",
"created_at": "2026-04-28T15:30:00Z",
"updated_at": "2026-04-29T12:00:00Z",
"stats": {
"open_positions": 0,
"total_pnl": "184.32",
"total_trades": 47,
"win_rate": "0.638"
}
}

Response fields

Same shape as Get Strategy. After a successful pause:

  • status is paused.
  • updated_at is the pause timestamp.
  • stats.open_positions is 0 if close_positions: true was supplied; otherwise unchanged.

When close_positions: true is used, position-close events stream over the Strategy Status WebSocket before this response is returned.

Errors

  • 404 NOT_FOUND — strategy does not exist or is not owned by the caller.
  • 409 INVALID_STATE — strategy status is not deployed. Already-paused strategies return this error rather than a no-op.

See Errors for the full list.

Example

curl -X POST "https://api.pipai.example/v1/strategies/strat_8f2a1b/pause" \
-H "X-PipAI-API-Key: $API_KEY" \
-H "X-PipAI-Timestamp: $TS" \
-H "X-PipAI-Signature: $SIG" \
-H "Content-Type: application/json" \
-d '{ "close_positions": true }'