Add a fill to a position.
const url = 'https://api.tradr.cloud/api/positions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/fills';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"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"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”The position the fill belongs to.
Request Bodyrequired
Section titled “Request Bodyrequired”object
Non-negative decimal.
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.
object
Must be an entry fill of this position.
Positive decimal.
Non-negative decimal.
Positive decimal.
Responses
Section titled “ Responses ”The created fill, plus positionClosed — true when this was the exit that balanced the entered quantity, which closes the position in the same transaction.
object
Decimal.
The stored selection on this fill, or null for an entry or an unselected exit.
object
Decimal.
Decimal.
Decimal.
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.