Skip to content
These docs describe Tradr v0.17.0. Running an older release? Check the release notes for what changed.

Close every open leg of a group at once.

POST
/api/position-groups/{id}/close
curl --request POST \
--url https://api.tradr.cloud/api/position-groups/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/close \
--header 'Content-Type: application/json' \
--data '{ "closedAt": "2026-04-15T12:00:00Z", "exits": [ { "fees": "example", "positionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "price": "example" } ] }'

Authed. In one transaction, writes one exit fill per open leg for its open units (carrying no lot selection) and closes it, all dated at closedAt or now; an already-closed leg is skipped even if named. Posts through the existing fill and close hooks per leg, under its own symbol — no group-level ledger row. An open leg missing from exits is a validation error naming it; any failure (including a closedAt before a leg’s open date, or a leg refused by the reopen guard) rolls back every leg and names the offending leg.

id
required
string format: uuid
Media typeapplication/json
object
closedAt
string format: date-time
exits
required
Array<object>
>= 1 items <= 8 items
object
fees
string
positionId
required
string format: uuid
price
required
string
Examplegenerated
{
"closedAt": "2026-04-15T12:00:00Z",
"exits": [
{
"fees": "example",
"positionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"price": "example"
}
]
}

The group

Validation error — a missing exit

The group was not found

Every leg is already closed