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

Create a trading rule.

POST
/api/trading-rules
curl --request POST \
--url https://api.tradr.cloud/api/trading-rules \
--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. The body carries the rule definition (type and parameters), a weight, an enabled flag and optional account and tag scopes. A scoped amount rule’s currency must equal the account’s currency. Subject to a per-user cap; an exact duplicate (same type, scope and parameters) is refused.

Media typeapplication/json
object
accountId
required
string format: uuid
nullable
definition
required
object
params
required
object
type
required
string
enabled
required
boolean
tagId
required
string format: uuid
nullable
weight
required
string
Allowed values: critical important nice_to_have

The created rule.

Validation error

No valid session.

TRADING_RULE_LIMIT_REACHED — the per-user rule cap has been reached; or TRADING_RULE_DUPLICATE — a rule with the same type, scope and parameters already exists.