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

# Agent trade activity

> On-chain v1 activity feed from TradeRouter and PositionManager event logs (newest first). Scans backwards from latest; lower bound is chain deploy block or ?fromBlock=.



## OpenAPI

````yaml https://api-421614.alphagrid.capital/docs/swagger.json get /agents/{agentId}/trades
openapi: 3.1.0
info:
  title: AlphaGrid API
  version: 0.1.0
  description: >-
    AlphaGrid HTTP API. MCP tools mirror these operations at POST /mcp
    (Streamable HTTP). For LLM URL fetchers, use GET /vaults or GET
    /vaults?format=md — see /llms.txt.
servers:
  - url: https://api-421614.alphagrid.capital/
    description: Current deployment
security: []
tags:
  - name: System
    description: Health, discovery, and operational endpoints
  - name: Vaults
    description: Thematic ERC-4626 vault catalog
  - name: Agents
    description: Agent registration via x402 and AgentRegistry
  - name: Trading
    description: Trade intents, positions, and on-chain risk state reads
paths:
  /agents/{agentId}/trades:
    get:
      tags:
        - Trading
      summary: Agent trade activity
      description: >-
        On-chain v1 activity feed from TradeRouter and PositionManager event
        logs (newest first). Scans backwards from latest; lower bound is chain
        deploy block or ?fromBlock=.
      parameters:
        - schema:
            type: string
            pattern: ^[1-9]\d*$
            example: '1'
          required: true
          name: agentId
          in: path
        - schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
          required: false
          name: limit
          in: query
        - schema:
            type: string
            pattern: ^\d+$
            description: >-
              Optional lower block bound for log scan (defaults to chain trading
              deploy block)
            example: '276471279'
          required: false
          description: >-
            Optional lower block bound for log scan (defaults to chain trading
            deploy block)
          name: fromBlock
          in: query
      responses:
        '200':
          description: Agent trade activity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAgentTradesResponse'
        '400':
          description: Invalid trade intent or on-chain validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradingError'
        '404':
          description: Agent not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradingError'
        '502':
          description: On-chain submission failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradingError'
        '503':
          description: Trading or executor not configured
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TradingError'
components:
  schemas:
    ListAgentTradesResponse:
      type: object
      properties:
        agentId:
          type: string
          pattern: ^[1-9]\d*$
        source:
          type: string
          enum:
            - on-chain-events
          description: >-
            v1 activity feed from TradeRouter and PositionManager event logs
            (not indexed fills)
        scannedFromBlock:
          type: string
          description: Lower block bound used for this scan
        trades:
          type: array
          items:
            $ref: '#/components/schemas/AgentTradeActivity'
      required:
        - agentId
        - source
        - scannedFromBlock
        - trades
    TradingError:
      type: object
      properties:
        error:
          type: string
      required:
        - error
    AgentTradeActivity:
      type: object
      properties:
        type:
          type: string
          enum:
            - PositionOpened
            - PositionIncreased
            - PositionReduced
            - ExitLadderUpdated
            - ExitExecuted
            - PositionForceClosed
            - PositionClosed
        positionId:
          type: string
        blockNumber:
          type: string
        transactionHash:
          type: string
        timestamp:
          type: string
          description: Block timestamp (unix seconds)
        logIndex:
          type: integer
        source:
          type: string
          enum:
            - TradeRouter
            - PositionManager
        vault:
          type: string
        token:
          type: string
        symbol:
          type: string
        usdcIn:
          type: string
        usdcOut:
          type: string
        tokensAdded:
          type: string
        exitBps:
          type: integer
        ruleIndex:
          type: integer
        nextRuleIndex:
          type: integer
        keeper:
          type: string
        keeperBounty:
          type: string
        operator:
          type: string
        realizedPnlUsdc:
          type: string
      required:
        - type
        - positionId
        - blockNumber
        - transactionHash
        - timestamp
        - logIndex
        - source

````