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

# Start parameter optimization

> Run a grid search over stop/target ATR multiplier combinations.



## OpenAPI

````yaml /api/openapi.json post /api/graph/v1/backtest/optimize
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/backtest/optimize:
    post:
      tags:
        - Backtest
      summary: Start parameter optimization
      description: Run a grid search over stop/target ATR multiplier combinations.
      operationId: start_optimization_api_graph_v1_backtest_optimize_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OptimizationRequest'
        required: true
      responses:
        '200':
          description: Optimization launched
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OptimizationResponse'
        '400':
          description: Invalid parameters
        '404':
          description: Feature disabled
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    OptimizationRequest:
      properties:
        symbols:
          items:
            type: string
          type: array
          maxItems: 20
          minItems: 1
          title: Symbols
        start_date:
          type: string
          format: date
          title: Start Date
        end_date:
          type: string
          format: date
          title: End Date
        signal_types:
          items:
            $ref: '#/components/schemas/SignalType'
          type: array
          minItems: 1
          title: Signal Types
          default:
            - vwap_touch
            - ib_breakout
            - ib_retest
            - or_hold
            - level_confluence
            - trend_continuation
        stop_atr_range:
          items:
            type: number
          type: array
          title: Stop Atr Range
          default:
            - 0.5
            - 0.75
            - 1
            - 1.25
            - 1.5
        target_atr_range:
          items:
            type: number
          type: array
          title: Target Atr Range
          default:
            - 1
            - 1.5
            - 2
            - 2.5
            - 3
        top_n:
          type: integer
          maximum: 50
          minimum: 1
          title: Top N
          default: 10
      type: object
      required:
        - symbols
        - start_date
        - end_date
      title: OptimizationRequest
      description: Request to launch a parameter optimization run.
    OptimizationResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        status:
          $ref: '#/components/schemas/BacktestStatus'
        results:
          anyOf:
            - items:
                $ref: '#/components/schemas/OptimizationResultSet'
              type: array
            - type: 'null'
          title: Results
        progress_pct:
          type: integer
          title: Progress Pct
          default: 0
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
      type: object
      required:
        - id
        - status
      title: OptimizationResponse
      description: Optimization run status and results.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SignalType:
      type: string
      enum:
        - vwap_touch
        - ib_breakout
        - ib_retest
        - or_hold
        - level_confluence
        - trend_continuation
      title: SignalType
      description: Intraday signal types available for backtesting.
    BacktestStatus:
      type: string
      enum:
        - pending
        - running
        - completed
        - failed
        - cancelled
      title: BacktestStatus
      description: Backtest run lifecycle status.
    OptimizationResultSet:
      properties:
        parameter_set:
          additionalProperties: true
          type: object
          title: Parameter Set
        total_trades:
          type: integer
          title: Total Trades
        win_rate:
          type: number
          title: Win Rate
        avg_rr_ratio:
          type: number
          title: Avg Rr Ratio
        sharpe_ratio:
          type: number
          title: Sharpe Ratio
        profit_factor:
          type: number
          title: Profit Factor
        max_drawdown:
          type: number
          title: Max Drawdown
      type: object
      required:
        - parameter_set
        - total_trades
        - win_rate
        - avg_rr_ratio
        - sharpe_ratio
        - profit_factor
        - max_drawdown
      title: OptimizationResultSet
      description: Results for a single parameter combination in an optimization run.
    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

````