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

Add a fill to a position.

POST
/api/positions/{id}/fills
curl --request POST \
--url https://api.tradr.cloud/api/positions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/fills \
--header 'Content-Type: application/json' \
--data '{ "fees": "0", "filledAt": "2026-04-15T12:00:00Z", "lotSelection": [ { "entryFillId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "quantity": "example" } ], "notes": "example", "price": "example", "quantity": "example", "type": "entry" }'

Authed. A position is a sequence of fills, not a single trade: add an entry fill to open or scale in, an exit fill to scale out or close. The position’s average price, open quantity, status, and realised P&L are all derived from its fills, so adding one recomputes them. Monetary and quantity fields are strings to preserve decimal precision. An exit may carry lotSelection to pick specific lots by specific identification; omitted, the exit matches FIFO against the oldest lots not already reserved by another exit’s selection.

id
required
string format: uuid

The position the fill belongs to.

Media typeapplication/json
object
fees

Non-negative decimal.

string
default: 0
filledAt
required
string format: date-time
lotSelection

Exit only. A specific-identification choice of lots: each item’s quantity must claim no more than its lot still has available, and every item’s quantity must sum to this fill’s quantity.

Array<object>
>= 1 items
object
entryFillId
required

Must be an entry fill of this position.

string format: uuid
quantity
required

Positive decimal.

string
notes
string
nullable <= 10000 characters
price
required

Non-negative decimal.

string
quantity
required

Positive decimal.

string
type
required
string
Allowed values: entry exit

The created fill, plus positionClosed — true when this was the exit that balanced the entered quantity, which closes the position in the same transaction.

Media typeapplication/json
object
createdAt
string format: date-time
fees

Decimal.

string
filledAt
string format: date-time
id
string format: uuid
lotSelection

The stored selection on this fill, or null for an entry or an unselected exit.

Array<object>
nullable
object
entryFillId
string format: uuid
quantity

Decimal.

string
notes
string
nullable
positionClosed
boolean
positionId
string format: uuid
price

Decimal.

string
quantity

Decimal.

string
type
string
Allowed values: entry exit
Example
{
"type": "entry"
}

Validation error: an exit quantity beyond the available entry quantity, a fractional quantity on an options position, a lotSelection on an entry fill, or a lotSelection repeating an entryFillId.

No such position for this user.

The position is closed, an exit fill was sent to a position that is still a draft, a lotSelection names an entry fill that is not an entry of this position, its quantities do not sum to the exit quantity, its claims exceed a lot, or the write would change an earlier exit’s matched lots.