> 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/owc.md).

# OWC

The **Opening Week Continuation (OWC)** module compares the early part of each trading week (e.g., Monday + X days) with the entire week.\
It helps identify whether early-week performance tends to **continue**, **reverse**, or **lose strength** by the end of the week.

***

## Concept

* The opening week period (`OWP`) represents the first *N* trading days of the week (default: Monday only).
* The module measures how this early phase aligns with the full week’s behavior.
* Key calculated aspects include:
  * **Directional consistency** (same or opposite direction between early and full week)
  * **Strength ratio** (`owp_return / week_return`)
  * **Range and volatility share** (portion of the week’s range covered early)
  * **Volume distribution** (share of weekly volume traded early)
  * **Correlation proxy** (`owp_return * week_return`)

These metrics reveal how much of a week’s performance is typically established early and whether early-week momentum sustains or fades.

***

## Parameters

| Parameter                 | Type   | Description                                                                |
| ------------------------- | ------ | -------------------------------------------------------------------------- |
| `symbol`                  | string | Target symbol (e.g. `AAPL`, `BTCUSD`)                                      |
| `start_date` / `end_date` | string | Custom analysis period (`YYYY-MM-DD`)                                      |
| `time_window`             | string | Predefined period (e.g. `3M`, `6M`, `12M`, `24M`, `5Y`)                    |
| `start_time` / `end_time` | string | UTC intraday session (default `13:30`–`20:00`)                             |
| `days`                    | int    | Number of trading days considered as the opening period (1–7, default `1`) |
| `include_extended_hours`  | bool   | Include pre-/post-market data                                              |
| `sort_by`                 | string | Metric used for ranking in `/top` (default `week_return`)                  |
| `limit`                   | int    | Number of top results to return (default `20`)                             |
| `desc`                    | bool   | Sort descending if `true`                                                  |

***

## Endpoints

| Endpoint                 | Description                                                          |
| ------------------------ | -------------------------------------------------------------------- |
| `GET /stats/owc`         | Returns week-by-week data including early-week and full-week metrics |
| `GET /stats/owc/summary` | Aggregated averages across all analyzed weeks                        |
| `GET /stats/owc/top`     | Top N weeks ranked by a chosen metric (e.g., `week_return`)          |
| `GET /stats/owc/doc`     | Returns field documentation for all OWC endpoints                    |

***

## Example Requests

### 1. Get raw weekly OWC data

```bash
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
  "https://api.statalpha.market/stats/owc?symbol=AAPL&time_window=12M&days=2"
```

### 2. Retrieve summary statistics

```bash
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
  "https://api.statalpha.market/stats/owc/summary?symbol=AAPL&time_window=12M&days=3"
```

### 3. Get top-performing weeks by return

```bash
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
  "https://api.statalpha.market/stats/owc/top?symbol=AAPL&time_window=12M&sort_by=week_return&limit=10"
```

***

## Example Response (summary excerpt)

```json
{
  "summary": {
    "total_weeks": 52,
    "green_weeks": 31,
    "green_weeks_pct": 59.6,
    "owp_green_pct": 62.3,
    "owp_same_direction_pct": 68.2,
    "owp_avg_strength_ratio": 0.74,
    "owp_avg_range_pct": 41.8,
    "owp_avg_volume_share": 39.2,
    "owp_avg_return_corr": 0.68
  },
  "time_window": "12M"
}
```

***

## Interpretation

| Metric                        | Meaning                                                                                      |
| ----------------------------- | -------------------------------------------------------------------------------------------- |
| **green\_weeks\_pct**         | Percentage of weeks where the overall close was higher than open                             |
| **owp\_green\_pct**           | % of weeks where the early-week period (OWP) closed higher than open                         |
| **owp\_same\_direction\_pct** | How often the early-week direction matched the full week’s direction                         |
| **owp\_avg\_strength\_ratio** | Ratio of early-week return vs. full-week return — values near 1 indicate strong continuation |
| **owp\_avg\_range\_pct**      | Average share of the week’s price range covered during the OWP                               |
| **owp\_avg\_volume\_share**   | Portion of total weekly volume traded during the early period                                |
| **owp\_avg\_return\_corr**    | Correlation proxy between early and full week returns (positive = continuation)              |

***

## Notes

* OWC analysis provides insight into **weekly market rhythm** and **momentum persistence**.
* Higher same-direction and correlation values suggest trend continuation from early-week activity.
* All metrics are accessible across all plans; plan differences affect only query flexibility.
* Cached responses improve response times for repeated queries.


---

# 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/owc.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.
