Ora
All guides All guides

Getting started

Your first decision in the Playground Call the API from your code Save, share and reuse queries

Financial decisions

Decide on a stock with just its symbol Write your own rule Read probabilities and choose thresholds

Rule playground

From English to rule Combining conditions Offsets and windows Reading beliefs Rules plus forecasts in one request Turning a rule into an alert or workflow

Automation

Send a Slack alert when a rule fires Send decisions to your own system Run a watchlist every day after the close

Production

Handle errors, rate limits and retries

Cookbooks

All cookbooks Rank a watchlist by probability Send a pre-open digest Trend filter plus entry trigger Breakout confirmation with volume RSI and Bollinger mean-reversion checks Gap-fill playbook to your order system Confidence-gated actions Detect two-way risk Size positions by volatility regime Risk guardrail before an order Ask many questions in one request Self-consistency: three wordings Route support tickets Is a headline relevant to a symbol?

Use cases

Tag financial news for trading signalsGuardrails for LLM appsSupport ticket triage and routingFilter retrieved passages before your LLM answersVerify claims and citations against a source

Guides / Financial decisions

Financial decisions · about 12 min

Write your own rule

Write a rule about a stock's price history, read the belief it returns, combine it with forecasts, and act on it daily.

You'll need
  • A signed-in account. Rules need a symbol in state.
  1. Pick a symbol

    Any of the roughly 2,000 US stocks and ETFs covered by ask-by-symbol. This guide uses NVDA; every answer below is real, for the session of 2026-10-30.

  2. Write a simple comparison

    In the Playground, set the state to the symbol and add a yes_no question with "ask" instead of "instructions":

    {
      "model": "ora-fin1",
      "state": {
        "symbol": "NVDA"
      },
      "questions": {
        "above_50d": {
          "type": "yes_no",
          "ask": "C > sma(C,50)"
        }
      }
    }
    Open this in the Playground
    {
      "model": "ora-fin1",
      "answers": {
        "above_50d": {
          "type": "yes_no",
          "yes_no": 0.0746,
          "rule": "C > sma(C,50)",
          "basis": "rule"
        }
      },
      "usage": {
        "input_tokens": 291,
        "output_tokens": 4
      },
      "context": {
        "source": "server",
        "symbol": "NVDA",
        "as_of": "2026-10-30"
      },
      "version": "ora-fin-0.1.1"
    }
  3. Read the belief

    above_50d is 0.0746: NVDA closed clearly under its 50-day average. A rule answer is a belief, not true/false: 0.50 is exactly on the line, and it moves toward 0.95 or 0.05 the further the reading is past the line, measured on that quantity's normal scale. So C > sma(C,200) at 0.5455 means "above, but only just".

  4. Combine with and / or

    QuestionRuleBelief
    above_200dC > sma(C,200)0.5455
    rsi_uprsi(C,14) > 500.073
    bothC > sma(C,200) and rsi(C,14) > 500.073
    eitherC > sma(C,200) or rsi(C,14) > 500.5455
    not_abovenot (C > sma(C,200))0.4545

    and takes the lower part (0.073), or the higher (0.5455), not is 1 minus (0.4545). Ask the parts as their own questions too: it shows which one held a combined rule down.

    Open this in the Playground
  5. Offsets and windows

    C[-3] is the close three bars ago. Windows take a period: sma(C,50), highest(C,20). The trap: max includes today, highest doesn't. On XLE:

    QuestionRuleBelief
    breakoutC > highest(C,20)0.6462
    neverC > max(C,20)0.5
    at_highC >= max(C,20)0.5
    up_3dC > C[-3]0.8947

    XLE closed at a new 20-session high, so the breakout form is true while C > max(C,20) sits exactly on the line: it can never be more than equal.

    Open this in the Playground
  6. Pattern functions

    Candlestick patterns are functions with no arguments. An English question about a pattern compiles to the same thing:

    {
      "model": "ora-fin1",
      "state": {
        "symbol": "NVDA"
      },
      "questions": {
        "inside": {
          "type": "yes_no",
          "ask": "inside_bar()"
        },
        "doji": {
          "type": "yes_no",
          "ask": "doji()"
        },
        "hammer": {
          "type": "yes_no",
          "ask": "hammer()"
        },
        "engulf_bear": {
          "type": "yes_no",
          "ask": "engulfing_bear()"
        },
        "inside_en": {
          "type": "yes_no",
          "instructions": "Is today an inside bar?"
        }
      }
    }
    QuestionBeliefbasis
    inside0.0564rule
    doji0.0735rule
    hammer0.1245rule
    engulf_bear0.0932rule
    inside_en0.0564pattern

    None of these patterns is present on NVDA's last bar. The full list is in Rule language.

    Open this in the Playground
  7. Mix a rule with a forecast

    A rule says what is true now; a forecast question says what is likely next. One request can hold both, and the next step's actions can use both:

    {
      "model": "ora-fin1",
      "state": {
        "symbol": "NVDA"
      },
      "questions": {
        "trend": {
          "type": "yes_no",
          "ask": "C > sma(C,200)"
        },
        "up_week": {
          "type": "yes_no",
          "instructions": "Will the stock be higher in a week?"
        },
        "drop5": {
          "type": "yes_no",
          "instructions": "Will it drop at least 5% at some point in the next month?"
        }
      },
      "actions": [
        {
          "id": "lean_long",
          "when": "trend >= 0.6 and up_week >= 0.55",
          "do": "slack",
          "connection": "trading-desk",
          "message": "{{symbol}} ({{as_of}}): in trend ({{trend|pct}}) and leaning up a week ({{up_week|pct}})."
        },
        {
          "id": "no_edge",
          "when": "else",
          "do": "slack",
          "connection": "trading-desk",
          "message": "{{symbol}} ({{as_of}}): no edge. Trend {{trend|pct}}, up a week {{up_week|pct}}, 5% drawdown {{drop5|pct}}."
        }
      ],
      "dry_run": true
    }
    Open this in the Playground
  8. Act on it (dry run)

    {
      "model": "ora-fin1",
      "answers": {
        "trend": {
          "type": "yes_no",
          "yes_no": 0.5455,
          "rule": "C > sma(C,200)",
          "basis": "rule"
        },
        "up_week": {
          "type": "yes_no",
          "yes_no": 0.527
        },
        "drop5": {
          "type": "yes_no",
          "yes_no": 0.523
        }
      },
      "usage": {
        "input_tokens": 355,
        "output_tokens": 12
      },
      "context": {
        "source": "server",
        "symbol": "NVDA",
        "as_of": "2026-10-30"
      },
      "version": "ora-fin-0.1.1",
      "actions": [
        {
          "id": "lean_long",
          "fired": false,
          "status": "skipped"
        },
        {
          "id": "no_edge",
          "fired": true,
          "status": "dry_run",
          "do": "slack",
          "connection": "trading-desk",
          "preview": {
            "text": "NVDA (2026-10-30): no edge. Trend 55%, up a week 53%, 5% drawdown 52%."
          }
        }
      ]
    }

    trend 0.5455 misses the 0.6 line, so lean_long was skipped and no_edge fired: the preview is exactly what Slack would get. Nothing was sent, because "dry_run": true.

  9. Run it daily as a workflow

    Put the same questions and actions in a workflow with a list of symbols and a time (16:45 New York after the close, or 08:30 before the open), press Test run, then untick dry run. See Run a watchlist every day and Send a pre-open digest.

What's next

Create an account Open the Playground Everything here also lives in the console, next to your keys and usage.