> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequency.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Get compression trend analysis

> Get volatility trend analysis for a stock.

## Trend Detection

Compares recent period (last N/2 days) to earlier period (first N/2 days):
- **compressing**: Recent avg ratio < earlier avg * 0.9
- **expanding**: Recent avg ratio > earlier avg * 1.1
- **stable**: Within 10% of earlier period

## Response Data

- Average, min, max compression ratios
- NR7 and inside day counts
- Trend direction with recent/earlier averages

## Query Parameters

- **days**: Analysis period (default: 20)

## Performance Target

<200ms response time.



## OpenAPI

````yaml /api/openapi.json get /api/graph/v1/stocks/{symbol}/compression/trend
openapi: 3.1.0
info:
  title: Sequency Graph API
  description: >

    # Sequency Graph-Native Trading API


    Graph-native API for trading intelligence, built on FalkorDB.


    ## Features


    - **Screener**: Filter stocks using graph-native queries with relationship
    expansion

    - **Stock Detail**: Complete stock context with all relationships

    - **Confluence Scoring**: Setup quality assessment with weighted components

    - **Strategy Matching**: Find matching options strategies via graph
    traversal

    - **Market Context**: Current market-wide context for trading decisions


    ## Data Sources


    All data is sourced from the FalkorDB knowledge graph, populated by:

    - Pattern detector (Go) - Technical indicators, patterns

    - Graph sync service - Levels, volume profiles, news, day classification
  version: 1.0.0
servers: []
security: []
paths:
  /api/graph/v1/stocks/{symbol}/compression/trend:
    get:
      tags:
        - Compression
      summary: Get compression trend analysis
      description: >-
        Get volatility trend analysis for a stock.


        ## Trend Detection


        Compares recent period (last N/2 days) to earlier period (first N/2
        days):

        - **compressing**: Recent avg ratio < earlier avg * 0.9

        - **expanding**: Recent avg ratio > earlier avg * 1.1

        - **stable**: Within 10% of earlier period


        ## Response Data


        - Average, min, max compression ratios

        - NR7 and inside day counts

        - Trend direction with recent/earlier averages


        ## Query Parameters


        - **days**: Analysis period (default: 20)


        ## Performance Target


        <200ms response time.
      operationId: get_compression_trend_api_graph_v1_stocks__symbol__compression_trend_get
      parameters:
        - name: symbol
          in: path
          required: true
          schema:
            type: string
            title: Symbol
        - name: days
          in: query
          required: false
          schema:
            type: integer
            maximum: 90
            minimum: 5
            description: Analysis period in days
            default: 20
            title: Days
          description: Analysis period in days
      responses:
        '200':
          description: Trend analysis
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompressionTrendResponse'
        '404':
          description: Stock not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CompressionTrendResponse:
      properties:
        symbol:
          type: string
          title: Symbol
          description: Stock ticker symbol
        period_days:
          type: integer
          title: Period Days
          description: Analysis period in days
        avg_compression_ratio:
          anyOf:
            - type: number
            - type: 'null'
          title: Avg Compression Ratio
        min_compression_ratio:
          anyOf:
            - type: number
            - type: 'null'
          title: Min Compression Ratio
        max_compression_ratio:
          anyOf:
            - type: number
            - type: 'null'
          title: Max Compression Ratio
        nr7_count:
          type: integer
          title: Nr7 Count
          default: 0
        inside_day_count:
          type: integer
          title: Inside Day Count
          default: 0
        trend_direction:
          type: string
          enum:
            - compressing
            - expanding
            - stable
          title: Trend Direction
          description: >-
            Volatility trend: compressing (volatility decreasing), expanding
            (increasing), or stable
        recent_avg_ratio:
          anyOf:
            - type: number
            - type: 'null'
          title: Recent Avg Ratio
          description: Average ratio in recent half of period
        earlier_avg_ratio:
          anyOf:
            - type: number
            - type: 'null'
          title: Earlier Avg Ratio
          description: Average ratio in earlier half of period
      type: object
      required:
        - symbol
        - period_days
        - trend_direction
      title: CompressionTrendResponse
      description: Response for compression trend analysis endpoint.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````