> ## Documentation Index
> Fetch the complete documentation index at: https://octo-98895abd.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Risk decomposition

> Split one share's daily return variance into the Ibovespa, a B3 sector index made orthogonal to it, and the residual specific to the stock. One row with the three shares (they add to 1), betas, hedge ratios per R$ 1 long, annualized volatilities and the same split without shock sessions. Realized and historical only, not investment advice.

## Overview

Split one share's daily return variance into the Ibovespa, a B3 sector index made orthogonal to it, and the residual specific to the stock. One row with the three shares (they add to 1), betas, hedge ratios per R\$ 1 long, annualized volatilities and the same split without shock sessions. Realized and historical only, not investment advice.

## Coverage

Coverage varies by dataset and date. [Check current dataset coverage](https://octo-98895abd.mintlify.site/api-docs/v2/operations/coverage/freshness.md) before drawing conclusions from missing data.

## Try the API

GET /prices/risk

<form>
  <details>
    <summary>Advanced options</summary>

    Include request diagnostics
    Bearer token (optional)

    The token is sent only to SILO and is not saved.
  </details>
</form>

[Request and response schema](https://octo-98895abd.mintlify.site/api-docs/v2/specs/prices-risk.json)

## Example

```bash theme={null}
curl --request GET 'https://zcjbtpxuhdekpwcxmepn.supabase.co/functions/v1/silo-api/v2/prices/risk?ticker=ITUB4&from=2025-11-18&to=2026-11-25' \
  --header "Authorization: Bearer $SILO_TOKEN"
```

## Method

OLS cascade on daily simple returns, computed from the stock's total-return closes and the total-return index levels after they are joined on the date:

```text theme={null}
beta_market = cov(r, m) / var(m)
gamma       = cov(s, m) / var(m);   s_perp = s - gamma * m
beta_sector = cov(r - beta_market * m, s_perp) / var(s_perp)
eps         = r - beta_market * m - beta_sector * s_perp
shares      = beta_market^2 var(m), beta_sector^2 var(s_perp), var(eps), each / var(r)
hedge_ibov  = -(beta_market - beta_sector * gamma);   hedge_sector = -beta_sector
```

Every step, the sector map, the shock and liquidity checks and a worked example: [How the risk decomposition is computed](https://octo-98895abd.mintlify.site/api-docs/guides/risk-decomposition.md).

## Example response

Computed with api.risk\_decompose's method on the production ITUB4 and index rows of 2025-11-18 to 2026-11-25, before the endpoint was deployed. This excerpt omits fields and pagination links.

```json theme={null}
{
  "data": [
    {
      "ticker": "ITUB4",
      "status": "ok",
      "window_from": "2025-11-18",
      "window_to": "2026-11-25",
      "n_returns": 251,
      "stock_series": "total_return",
      "sector_leg": "IFNC",
      "sector_leg_basis": "cvm_setor_map",
      "market_share": 0.799814,
      "sector_share": 0.052996,
      "residual_share": 0.14719,
      "vol_total": 0.308641,
      "vol_market": 0.276025,
      "vol_sector": 0.071052,
      "vol_residual": 0.118411,
      "beta_market": 1.131368,
      "beta_sector": 0.664317,
      "gamma": 1.453225,
      "hedge_ibov": -0.165966,
      "hedge_sector": -0.664317,
      "ex_shock_n_returns": 248,
      "ex_shock_market_share": 0.711204,
      "ex_shock_sector_share": 0.106974,
      "ex_shock_residual_share": 0.181823,
      "shock_dates": [
        "2025-12-05",
        "2026-10-05",
        "2026-10-26"
      ],
      "shock_sensitive": false
    }
  ],
  "meta": {
    "tier": "pro"
  }
}
```

## FAQ

> [accordion] How do I check for more results?
>
> When present, follow `next_page_url` to request the next page. See [pagination and errors](https://octo-98895abd.mintlify.site/api-docs/v2/responses.md).

> [accordion] Can an agent use this data?
>
> Yes. Connect an agent through the [MCP server](https://octo-98895abd.mintlify.site/api-docs/v2/mcp.md).

[Python DataFrames](https://octo-98895abd.mintlify.site/api-docs/v2/python.md)


## OpenAPI

````yaml api-docs/v2/specs/prices-risk.json GET /prices/risk
openapi: 3.1.0
info:
  title: SILO API v2
  version: v2
  description: >-
    The v2 gateway over SILO's schema `api`: 14 resources, five shared
    parameters, one envelope and one error object. Generated from
    supabase/functions/silo-api/registry.ts by scripts/gen_openapi_v2.py; do not
    edit by hand. The original v1 API stays available until it is retired.
servers:
  - url: https://zcjbtpxuhdekpwcxmepn.supabase.co/functions/v1/silo-api/v2
    description: The silo-api Edge Function.
security:
  - {}
  - bearerAuth: []
tags:
  - name: Discovery
  - name: Markets and macro
  - name: Companies and funds
  - name: Research
paths:
  /prices/risk:
    get:
      tags:
        - Markets and macro
      summary: Risk decomposition
      description: >-
        Split one share's daily return variance into the Ibovespa, a B3 sector
        index made orthogonal to it, and the residual specific to the stock. One
        row with the three shares (they add to 1), betas, hedge ratios per R$ 1
        long, annualized volatilities and the same split without shock sessions.
        Realized and historical only, not investment advice.
      operationId: v2_prices_risk
      parameters:
        - name: ticker
          in: query
          required: true
          description: Trading symbol of a share or unit.
          schema:
            type: string
          example: ITUB4
        - name: from
          in: query
          required: false
          description: Start date (YYYY-MM-DD).
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: End date (YYYY-MM-DD).
          schema:
            type: string
            format: date
        - name: sector
          in: query
          required: false
          description: >-
            Sector leg: none, or a B3 index code other than IBOV. Omit to use
            the map from the company's CVM sector.
          schema:
            type: string
        - name: limit
          in: query
          required: false
          description: Rows per page, subject to your tier.
          schema:
            type: integer
            minimum: 1
        - name: cursor
          in: query
          required: false
          description: Cursor from the next page URL.
          schema:
            type: string
        - name: Authorization
          in: header
          required: false
          description: Optional Bearer token for signed-in or Pro access.
          schema:
            type: string
        - name: details
          in: query
          required: false
          description: Include request diagnostics.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: The v2 envelope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
              example:
                data:
                  - ticker: ITUB4
                    status: ok
                    window_from: '2025-11-18'
                    window_to: '2026-11-25'
                    n_returns: 251
                    stock_series: total_return
                    sector_leg: IFNC
                    sector_leg_basis: cvm_setor_map
                    market_share: 0.799814
                    sector_share: 0.052996
                    residual_share: 0.14719
                    vol_total: 0.308641
                    vol_market: 0.276025
                    vol_sector: 0.071052
                    vol_residual: 0.118411
                    beta_market: 1.131368
                    beta_sector: 0.664317
                    gamma: 1.453225
                    hedge_ibov: -0.165966
                    hedge_sector: -0.664317
                    ex_shock_n_returns: 248
                    ex_shock_market_share: 0.711204
                    ex_shock_sector_share: 0.106974
                    ex_shock_residual_share: 0.181823
                    shock_dates:
                      - '2025-12-05'
                      - '2026-10-05'
                      - '2026-10-26'
                    shock_sensitive: false
                meta:
                  tier: pro
        default:
          description: >-
            The v2 error object. A SILO refusal (over_limit) keeps its message,
            hint and details verbatim.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security: []
components:
  schemas:
    Envelope:
      type: object
      required:
        - data
        - meta
      properties:
        data:
          type: array
          items: {}
          description: Always a list. Rows as the endpoint returned them; null stays null.
        meta:
          type: object
          required:
            - tier
          properties:
            source:
              type: string
              description: >-
                The canonical request to cite: /v2/<resource>? with every
                applied parameter, defaults included, so it replays the same
                rows. POST says so; its lists are in meta.body.
            data_through:
              type:
                - string
                - 'null'
              format: date
              description: >-
                The newest elapsed period SILO holds for the dataset this
                endpoint reads (the coverage resource's data_through for
                coverage_dataset). Null when no coverage row applies or the
                coverage read failed; never a guess.
            coverage_dataset:
              type:
                - string
                - 'null'
              description: >-
                The coverage dataset data_through comes from; null when none
                applies.
            data_through_error:
              type: string
              description: >-
                Present only when the coverage read failed: why data_through is
                null. The rows are unaffected.
            tier:
              type: string
              enum:
                - anonymous
                - signed_in
                - pro
            tier_cap_reached:
              type: boolean
              description: True when the result is partial because of the tier cap.
          additionalProperties: true
        next_page_url:
          type: string
          description: Present only when more rows remain. It carries one opaque cursor.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - reason
            - message
            - target
            - innererror
          properties:
            code:
              type: string
              enum:
                - bad_request
                - unknown_parameter
                - unknown_id
                - unauthorized
                - payment_required
                - forbidden_for_tier
                - over_limit
                - rate_limited
                - timeout
                - unavailable
                - internal
            reason:
              type:
                - string
                - 'null'
              enum:
                - row_cap
                - tier_cap
                - null
              description: >-
                over_limit only: row_cap (over one 1,000-row page: narrow or
                page) or tier_cap (over the tier ceiling: narrow or sign in).
                Null otherwise.
            message:
              type: string
            target:
              type:
                - string
                - 'null'
            innererror:
              type: object
              properties:
                sqlstate:
                  type:
                    - string
                    - 'null'
                hint:
                  type:
                    - string
                    - 'null'
                details:
                  type:
                    - string
                    - 'null'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: SILO user access token for authenticated data requests.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.