Endpoints · Strategies

Close a position

POST/v2/strategies/{name}/positions/{id}/close

Force-close a position at a caller-supplied price. The endpoint marks the position closed (or scales it down via `size_pct`), updates `shares_remaining` and `realized_pnl_dollars`, and sets `exit_reason: 'manual'` when the position is fully closed. PnL math: `(price - entry_price) * shares_to_close * direction` where `direction` is +1 for long, -1 for short. `price` is supplied by the caller because the v1 runner does not yet have a live-quote integration; the caller is expected to pass the current market price (or a fill price from an external broker).

Plan access

Hobby and above.

Rate limit

Hobby 60/min · Pro 2,000/min · Scale 10,000/min.

Capacity

Counts against your saved-rule capacity until v1.5 introduces a separate cap.

stringrequired

Strategy slug.

stringrequired

Position UUID — see the list-positions endpoint.

200
{ as_of, ok: true, closed_shares, remaining_shares, realized_pnl_dollars, fully_closed }.
400
bad_request — invalid name, id, price, or size_pct.
404
not_found — no open position with that id on this strategy.