Update a position.
const url = 'https://api.tradr.cloud/api/positions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PUT', headers: {'Content-Type': 'application/json'}, body: '{"accountId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","assetType":"stock","notes":"example","side":"long","stopLoss":"140.00","symbol":"example","targetPrice":"150.00"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.tradr.cloud/api/positions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Content-Type: application/json' \ --data '{ "accountId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "assetType": "stock", "notes": "example", "side": "long", "stopLoss": "140.00", "symbol": "example", "targetPrice": "150.00" }'Authed. All fields optional. On a draft position every field is editable. On open and closed positions only notes, targetPrice, and stopLoss may change — the trade-plan fields are plan annotations that do not affect fill quantities; any other field on a non-draft position is rejected with 409.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Trade-plan stop-loss price. Positive decimal string with up to 8 decimal places, or null. Editable on any status.
Example
140.00Trade-plan target price. Positive decimal string with up to 8 decimal places, or null. Editable on any status.
Example
150.00Responses
Section titled “ Responses ”The updated position.
Validation error (e.g. an invalid option symbol or plan price).
Position not found (or not owned), or the target account not found.
A restricted field (symbol/side/assetType/accountId) was changed on a non-draft position, or an asset-type change was attempted.