> For the complete documentation index, see [llms.txt](https://statalpha.gitbook.io/statalpha-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://statalpha.gitbook.io/statalpha-docs/stats/orb.md).

# ORB

The **Opening Range Breakout (ORB)** module identifies when price breaks above or below the initial range of the trading day.\
It is a key statistical component for analyzing market momentum, volatility, and directional bias.

***

## Concept

* The **opening range** is defined by the high and low of the first *N* minutes after the market opens.
* A **breakout** occurs when price moves above or below this range.
* **Double breakouts** (both directions) are detected and tracked with sequence information (`up-down` or `down-up`).
* The algorithm measures:
  * **Breakout size and percentage**
  * **Breakout timing**
  * **Direction frequency (up/down/double)**
  * **Weekday behavior patterns**

***

## Parameters

| Parameter                 | Type   | Description                                                                       |
| ------------------------- | ------ | --------------------------------------------------------------------------------- |
| `symbol`                  | string | Asset symbol (e.g. `AAPL`, `BTCUSD`)                                              |
| `start_date` / `end_date` | string | For `/stats/orb`: must be the same day (`YYYY-MM-DD`)                             |
| `time_window`             | string | For `/stats/orb/summary`: predefined range (`1M`, `3M`, `6M`, `12M`, `24M`, `5Y`) |
| `start_time` / `end_time` | string | UTC session range (default `13:30`–`20:00`)                                       |
| `orb_minutes`             | int    | Opening range duration (e.g. `1`, `2`, `5`, `15`)                                 |
| `include_extended_hours`  | bool   | Include pre-/post-market data                                                     |
| `orb_reentry_candles`     | int    | Number of candles required to confirm reentry after breakout                      |
| `top_n`                   | int    | Limit for `/top` endpoint                                                         |
| `min_breakout_size`       | float  | Threshold for `/top-picks` filtering (price units)                                |

***

## Endpoints

| Endpoint                   | Description                                          |
| -------------------------- | ---------------------------------------------------- |
| `GET /stats/orb`           | Returns full ORB details for a single day and symbol |
| `GET /stats/orb/summary`   | Aggregated statistics over a selected range          |
| `GET /stats/orb/top`       | Lists top N breakout symbols for a given day         |
| `GET /stats/orb/top-picks` | Returns all symbols with breakouts above threshold   |
| `GET /stats/orb/doc`       | Returns documentation of all ORB fields              |

***

## Example Requests

### 1. Get single-day ORB

```bash
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
  "https://api.statalpha.market/stats/orb?symbol=AAPL&start_date=2025-09-12&orb_minutes=5"
```

### 2. ORB summary over 12 months

```bash
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
  "https://api.statalpha.market/stats/orb/summary?symbol=TSLA&time_window=12M&orb_minutes=5"
```

### 3. Top 10 daily breakouts

```bash
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
  "https://api.statalpha.market/stats/orb/top?start_date=2025-09-12&orb_minutes=5&top_n=10"
```

### 4. Breakouts above a custom threshold

```bash
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
  "https://api.statalpha.market/stats/orb/top-picks?date=2025-09-12&orb_minutes=5&min_breakout_size=0.5"
```

***

## Example Response (summary excerpt)

```json
{
  "symbol": "AAPL",
  "orb_minutes": 5,
  "total_days": 245,
  "any_breakout_up_rate": 58.7,
  "any_breakout_down_rate": 41.3,
  "exclusive_no_breakout_rate": 12.4,
  "avg_breakout_up_size": 0.83,
  "avg_breakout_down_size": 0.79,
  "avg_breakout_up_size_pct": 0.74,
  "avg_breakout_down_size_pct": 0.69,
  "avg_breakout_up_time": "14:22:00 UTC",
  "avg_breakout_down_time": "15:08:00 UTC",
  "breakout_summary": {
    "double_breakout_rate": 8.3,
    "only_up_rate": 52.7,
    "only_down_rate": 39.0,
    "no_breakout_rate": 12.4
  },
  "time_window": "12M"
}
```

***

## Interpretation

| Metric                                   | Meaning                                                          |
| ---------------------------------------- | ---------------------------------------------------------------- |
| **any\_breakout\_up\_rate / down\_rate** | % of sessions where breakout occurred in each direction          |
| **exclusive\_no\_breakout\_rate**        | % of sessions with no breakout at all                            |
| **avg\_breakout\_up/down\_size\_pct**    | Average breakout size relative to opening range                  |
| **avg\_breakout\_up/down\_time**         | Average breakout time (UTC)                                      |
| **double\_breakout\_rate**               | % of sessions with both up and down breakouts                    |
| **weekday\_summary**                     | Shows breakout tendencies per weekday (only in summary endpoint) |

***

## Notes

* ORB analysis helps identify **momentum continuation** and **volatility expansion** early in the session.
* Double breakouts often indicate **indecision or high volatility days**.
* Cached responses ensure stable performance and consistent statistics for repeated requests.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://statalpha.gitbook.io/statalpha-docs/stats/orb.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
