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

# Record a trade outcome

> Record a trade outcome for UAT analysis.

## Trade Status Inference
- If `is_cancelled=True` -> status = 'cancelled'
- If exit_time, exit_price, AND pnl_dollars ALL present -> status = 'closed'
- If NONE of them present -> status = 'pending'

## Required Fields
- symbol, direction, entry_time, entry_price, quantity, outcome_source

## Optional Context
- confluence_tier, confluence_score, net_confluence, directional_bias
- day_type, vix_regime, account_tier
- scan_id, action_card_id, variant_id (for linking)



## OpenAPI

````yaml /api/openapi.json post /api/uat/v1/trades
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/uat/v1/trades:
    post:
      tags:
        - UAT Testing
      summary: Record a trade outcome
      description: >-
        Record a trade outcome for UAT analysis.


        ## Trade Status Inference

        - If `is_cancelled=True` -> status = 'cancelled'

        - If exit_time, exit_price, AND pnl_dollars ALL present -> status =
        'closed'

        - If NONE of them present -> status = 'pending'


        ## Required Fields

        - symbol, direction, entry_time, entry_price, quantity, outcome_source


        ## Optional Context

        - confluence_tier, confluence_score, net_confluence, directional_bias

        - day_type, vix_regime, account_tier

        - scan_id, action_card_id, variant_id (for linking)
      operationId: record_trade_api_uat_v1_trades_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TradeOutcomeCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradeOutcome'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    TradeOutcomeCreate:
      properties:
        symbol:
          type: string
          maxLength: 10
          minLength: 1
          title: Symbol
        direction:
          $ref: '#/components/schemas/TradeDirection-Input'
        entry_time:
          type: string
          format: date-time
          title: Entry Time
        entry_price:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Entry Price
        quantity:
          type: integer
          exclusiveMinimum: 0
          title: Quantity
        outcome_source:
          $ref: '#/components/schemas/OutcomeSource'
        exit_time:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Exit Time
        exit_price:
          anyOf:
            - type: number
              exclusiveMinimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Exit Price
        pnl_dollars:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Pnl Dollars
        pnl_percent:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Pnl Percent
        scan_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Scan Id
        action_card_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Action Card Id
        position_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Position Id
        variant_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Variant Id
        tradestation_order_id:
          anyOf:
            - type: string
              maxLength: 50
            - type: 'null'
          title: Tradestation Order Id
        confluence_tier:
          anyOf:
            - $ref: '#/components/schemas/ConfluenceTier-Input'
            - type: 'null'
        confluence_score:
          anyOf:
            - type: number
              maximum: 100
              minimum: 0
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Confluence Score
        net_confluence:
          anyOf:
            - type: number
              maximum: 100
              minimum: -100
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Net Confluence
          description: >-
            Net confluence (-100 to +100): bullish_confluence -
            bearish_confluence
        directional_bias:
          anyOf:
            - type: string
              maxLength: 20
            - type: 'null'
          title: Directional Bias
          description: >-
            Directional bias: STRONG_LONG, MOD_LONG, NEUTRAL, MOD_SHORT,
            STRONG_SHORT
        day_type:
          anyOf:
            - type: string
              maxLength: 20
            - type: 'null'
          title: Day Type
        vix_regime:
          anyOf:
            - type: string
              maxLength: 20
            - type: 'null'
          title: Vix Regime
        account_tier:
          anyOf:
            - type: integer
              maximum: 3
              minimum: 1
            - type: 'null'
          title: Account Tier
        is_cancelled:
          type: boolean
          title: Is Cancelled
          description: Explicitly mark trade as cancelled (pnl must be None)
          default: false
      type: object
      required:
        - symbol
        - direction
        - entry_time
        - entry_price
        - quantity
        - outcome_source
      title: TradeOutcomeCreate
      description: |-
        Request model for recording a trade outcome.

        trade_status is auto-inferred from provided fields:
        - If is_cancelled=True -> 'cancelled'
        - If exit_time, exit_price, AND pnl_dollars ALL present -> 'closed'
        - If NONE of them present -> 'pending'
        - Partial data -> validation error
    TradeOutcome:
      properties:
        outcome_id:
          type: string
          format: uuid
          title: Outcome Id
        entry_time:
          type: string
          format: date-time
          title: Entry Time
        exit_time:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Exit Time
        recorded_at:
          type: string
          format: date-time
          title: Recorded At
        trade_status:
          $ref: '#/components/schemas/TradeStatus'
        scan_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Scan Id
        action_card_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Action Card Id
        position_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Position Id
        variant_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Variant Id
        tradestation_order_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tradestation Order Id
        symbol:
          type: string
          title: Symbol
        direction:
          $ref: '#/components/schemas/app__models__uat__TradeDirection'
        entry_price:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Entry Price
        exit_price:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Exit Price
        quantity:
          type: integer
          title: Quantity
        pnl_dollars:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Pnl Dollars
        pnl_percent:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Pnl Percent
        is_winner:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Winner
        hold_duration_m:
          anyOf:
            - type: integer
            - type: 'null'
          title: Hold Duration M
        confluence_tier:
          anyOf:
            - $ref: '#/components/schemas/app__models__uat__ConfluenceTier'
            - type: 'null'
        confluence_score:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Confluence Score
        net_confluence:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Net Confluence
        directional_bias:
          anyOf:
            - type: string
            - type: 'null'
          title: Directional Bias
        day_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Day Type
        vix_regime:
          anyOf:
            - type: string
            - type: 'null'
          title: Vix Regime
        account_tier:
          anyOf:
            - type: integer
            - type: 'null'
          title: Account Tier
        outcome_source:
          $ref: '#/components/schemas/OutcomeSource'
      type: object
      required:
        - outcome_id
        - entry_time
        - exit_time
        - recorded_at
        - trade_status
        - scan_id
        - action_card_id
        - position_id
        - variant_id
        - tradestation_order_id
        - symbol
        - direction
        - entry_price
        - exit_price
        - quantity
        - pnl_dollars
        - pnl_percent
        - is_winner
        - hold_duration_m
        - confluence_tier
        - confluence_score
        - day_type
        - vix_regime
        - account_tier
        - outcome_source
      title: TradeOutcome
      description: Full trade outcome model with server-generated fields.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TradeDirection-Input:
      type: string
      enum:
        - long
        - short
      title: TradeDirection
      description: 'Trade direction: long or short.'
    OutcomeSource:
      type: string
      enum:
        - tradestation_api
        - manual_cli
        - journal_import
      title: OutcomeSource
      description: Source of trade outcome data.
    ConfluenceTier-Input:
      type: string
      enum:
        - EXCELLENT
        - GOOD
        - MODERATE
        - WEAK
        - POOR
      title: ConfluenceTier
      description: Confluence tier classification.
    TradeStatus:
      type: string
      enum:
        - pending
        - closed
        - cancelled
      title: TradeStatus
      description: Trade lifecycle status.
    app__models__uat__TradeDirection:
      type: string
      enum:
        - long
        - short
      title: TradeDirection
      description: 'Trade direction: long or short.'
    app__models__uat__ConfluenceTier:
      type: string
      enum:
        - EXCELLENT
        - GOOD
        - MODERATE
        - WEAK
        - POOR
      title: ConfluenceTier
      description: Confluence tier classification.
    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

````