create_decision_rule
Utworzenie reguły decyzyjnej, która ma pilnować warunku za Ciebie.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Discriminated by kind. `alert_agent` = {kind: 'alert_agent', message, priority?: low|medium|high|critical} (`message` is required, priority defaults to medium). `propose_trade` = {kind: 'propose_trade', side: buy|sell|trim, message, sizingHint?: string|null}. `auto_execute` = {kind: 'auto_execute', side: buy|sell, notionalPLN, rationale}; accepted by the schema but blocked by the worker. | |
| trigger | Yes | Discriminated by kind: position_drawdown, thesis_validity, news_classification, or price_level. ⛔ `price_level` = {symbol, universe, operator: lte|gte, price, basis?: last|close} — the plain [alert me when X crosses P] rule the other three cannot express: position_drawdown needs you to ALREADY HOLD the name (so it cannot express a BUY ladder rung), thesis_validity talks about a thesis, news_classification about a headline. **`universe` is REQUIRED** and takes a registered universe: `polish-stocks`, `czech-stocks`, `hungarian-stocks`, `romanian-stocks`, `us-stocks`, `german-stocks`, or `crypto`. The same ticker can live on multiple markets (PEP is Pepco in Warsaw and PepsiCo in New York), so without the market a threshold of 390 names neither an instrument nor a currency, and the rule is rejected at creation. Price-level evaluation currently has quote support for `polish-stocks` and `us-stocks`; a registered market without a quote adapter is retained but does not fire. **`price` is in the QUOTE CURRENCY, not PLN** — us-stocks quotes and candles are stored in dollars, so [AVGO below 390] means 390 USD; the fired event carries `currencyNote` saying so. `basis` defaults to `last` (newest `price_quotes` row, ~15 min delayed); it falls back to the daily close and says so in `basisUsed`. A price older than the freshness window does NOT fire — it refuses with a reason, because a rung proposed on yesterday's quote is a trade at a price that no longer exists. | |
| ruleName | Yes | Human-readable name, <=120 chars. | |
| expiresAt | No | Optional ISO expiry. Null/omitted means no expiry. | |
| cooldownMinutes | No | 0-43200. Default 60. |