Replace a trading rule.
PUT
/api/trading-rules/{id}
const url = 'https://api.tradr.cloud/api/trading-rules/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PUT', headers: {'Content-Type': 'application/json'}, body: '{"accountId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","definition":{"params":{},"type":"example"},"enabled":true,"tagId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","weight":"critical"}'};
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/trading-rules/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Content-Type: application/json' \ --data '{ "accountId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "definition": { "params": {}, "type": "example" }, "enabled": true, "tagId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "weight": "critical" }'Authed. A full replacement — the whole rule, definition included, is sent. The same scope, currency and duplicate rules apply as on create.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”id
required
string format: uuid
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
accountId
required
string format: uuid
definition
required
object
params
required
object
type
required
string
enabled
required
boolean
tagId
required
string format: uuid
weight
required
string
Responses
Section titled “ Responses ”The updated rule.
Validation error
No valid session.
No such rule for this user.
TRADING_RULE_DUPLICATE — a rule with the same type, scope and parameters already exists.