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

# Calculate position size

> Calculate position size with all modifiers applied.

## Position Sizing Formula

max_risk_dollars = base_risk × account_value × combined_modifier

max_contracts = max_risk_dollars / (premium × stop_loss_pct)

## Modifiers Applied

1. **Confluence Grade**: EXCELLENT (1.0) → POOR (0.25)
2. **Day Type**: trending (1.0), rotational (0.75), uncertain (0.5)
3. **VIX Regime**: low_complacent (0.8), normal (1.0), elevated (0.75), fear (0.5)
4. **Conviction Level**: Based on signal scoring

## Base Risk by Tier

| Tier | Base Risk |
|------|-----------|
| 1 | 1.0% |
| 2 | 1.0% |
| 3 | 0.75% |

## Performance Target

<100ms response time.



## OpenAPI

````yaml /api/openapi.json post /api/graph/v1/risk/position-size
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/risk/position-size:
    post:
      tags:
        - Risk Management
      summary: Calculate position size
      description: >-
        Calculate position size with all modifiers applied.


        ## Position Sizing Formula


        max_risk_dollars = base_risk × account_value × combined_modifier


        max_contracts = max_risk_dollars / (premium × stop_loss_pct)


        ## Modifiers Applied


        1. **Confluence Grade**: EXCELLENT (1.0) → POOR (0.25)

        2. **Day Type**: trending (1.0), rotational (0.75), uncertain (0.5)

        3. **VIX Regime**: low_complacent (0.8), normal (1.0), elevated (0.75),
        fear (0.5)

        4. **Conviction Level**: Based on signal scoring


        ## Base Risk by Tier


        | Tier | Base Risk |

        |------|-----------|

        | 1 | 1.0% |

        | 2 | 1.0% |

        | 3 | 0.75% |


        ## Performance Target


        <100ms response time.
      operationId: calculate_position_size_api_graph_v1_risk_position_size_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PositionSizingRequest'
        required: true
      responses:
        '200':
          description: Position sizing calculation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PositionSizingResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    PositionSizingRequest:
      properties:
        account_value:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Account Value
        tier:
          type: integer
          maximum: 3
          minimum: 1
          title: Tier
          description: Account tier (1, 2, or 3)
        stop_loss_pct:
          anyOf:
            - type: number
              maximum: 1
              exclusiveMinimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Stop Loss Pct
          description: Stop loss as decimal (0.40 = 40%)
        confluence:
          type: string
          title: Confluence
          description: EXCELLENT, GOOD, MODERATE, WEAK, POOR
        day_type:
          type: string
          title: Day Type
          description: trending, rotational, uncertain
        vix_regime:
          type: string
          title: Vix Regime
          description: low_complacent, normal, elevated, fear
      type: object
      required:
        - account_value
        - tier
        - stop_loss_pct
        - confluence
        - day_type
        - vix_regime
      title: PositionSizingRequest
      description: Request for position sizing calculation.
    PositionSizingResponse:
      properties:
        max_risk_dollars:
          type: number
          title: Max Risk Dollars
        max_contracts:
          type: integer
          title: Max Contracts
        combined_modifier:
          type: number
          title: Combined Modifier
        rationale:
          type: string
          title: Rationale
        inputs:
          additionalProperties: true
          type: object
          title: Inputs
      type: object
      required:
        - max_risk_dollars
        - max_contracts
        - combined_modifier
        - rationale
      title: PositionSizingResponse
      description: Response for position sizing calculation.
    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

````