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

# Agent modifies position (Open → Open)

> Agent modifies an open position (stops, targets, P&L update).



## OpenAPI

````yaml /api/openapi.json patch /api/internal/trade-cards/{card_id}/position
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/internal/trade-cards/{card_id}/position:
    patch:
      tags:
        - Internal Trade Cards
      summary: Agent modifies position (Open → Open)
      description: Agent modifies an open position (stops, targets, P&L update).
      operationId: agent_modify_position_api_internal_trade_cards__card_id__position_patch
      parameters:
        - name: card_id
          in: path
          required: true
          schema:
            type: string
            title: Card Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentModifyPosition'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentActionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AgentModifyPosition:
      properties:
        current_shares:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Current Shares
        current_avg_price:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Current Avg Price
        unrealized_pnl:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Unrealized Pnl
        exit_rules:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Exit Rules
          description: Updated exit rules
        market_snapshot:
          anyOf:
            - $ref: '#/components/schemas/MarketSnapshot-Input'
            - type: 'null'
        reason:
          type: string
          title: Reason
          description: Why the modification was made
          default: ''
      type: object
      title: AgentModifyPosition
      description: Agent modifies an open position (stop/target/scale adjustments).
    AgentActionResponse:
      properties:
        card_id:
          type: string
          format: uuid
          title: Card Id
        action:
          type: string
          title: Action
        column_state:
          type: string
          title: Column State
          default: ''
        substate:
          anyOf:
            - type: string
            - type: 'null'
          title: Substate
        success:
          type: boolean
          title: Success
          default: true
        message:
          type: string
          title: Message
          default: ''
      type: object
      required:
        - card_id
        - action
      title: AgentActionResponse
      description: Response for all agent actions.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MarketSnapshot-Input:
      properties:
        ts:
          type: string
          format: date-time
          title: Ts
          description: Snapshot timestamp (matches AuditEntry.ts)
        bar_symbol:
          type: string
          title: Bar Symbol
          default: ''
        bar_open:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Bar Open
        bar_high:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Bar High
        bar_low:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Bar Low
        bar_close:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Bar Close
        bar_volume:
          anyOf:
            - type: integer
            - type: 'null'
          title: Bar Volume
        bar_vwap:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Bar Vwap
        quote_bid:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Quote Bid
        quote_ask:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Quote Ask
        quote_bid_size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Quote Bid Size
        quote_ask_size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Quote Ask Size
        indicators:
          additionalProperties:
            type: number
          type: object
          title: Indicators
        regime_dominant:
          type: string
          title: Regime Dominant
          default: ''
        regime_confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Regime Confidence
        signals:
          additionalProperties:
            type: number
          type: object
          title: Signals
        risk_day_dollars:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Risk Day Dollars
        risk_pct_cap:
          anyOf:
            - type: number
            - type: 'null'
          title: Risk Pct Cap
        risk_loss_remaining:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Risk Loss Remaining
      type: object
      required:
        - ts
      title: MarketSnapshot
      description: |-
        Frozen picture of the market state at the moment an agent made a
        decision. Required on audit entries where actor=agent and the action
        changes card state. See spec §4.5.
    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

````