Alpaca · Capability

Trader API — Positions

Trader API — Positions. 4 operations. Lead operation: All Open Positions. Self-contained Naftiko capability covering one Alpaca business surface.

Run with Naftiko AlpacaPositions

What You Can Do

GET
Getallopenpositions — All Open Positions
/v1/v2/positions
DELETE
Deleteallopenpositions — All Positions
/v1/v2/positions
GET
Getopenposition — Open Position
/v1/v2/positions/{symbol-or-asset-id}
DELETE
Deleteopenposition — Position
/v1/v2/positions/{symbol-or-asset-id}

MCP Tools

all-open-positions

All Open Positions

read-only idempotent
all-positions

All Positions

idempotent
open-position

Open Position

read-only idempotent
position

Position

idempotent

Capability Spec

trading-positions.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Trader API — Positions
  description: 'Trader API — Positions. 4 operations. Lead operation: All Open Positions. Self-contained Naftiko capability
    covering one Alpaca business surface.'
  tags:
  - Alpaca
  - Positions
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    ALPACA_API_KEY: ALPACA_API_KEY
capability:
  consumes:
  - type: http
    namespace: trading-positions
    baseUri: https://paper-api.alpaca.markets
    description: Trader API — Positions business capability. Self-contained, no shared references.
    resources:
    - name: v2-positions
      path: /v2/positions
      operations:
      - name: getallopenpositions
        method: GET
        description: All Open Positions
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: deleteallopenpositions
        method: DELETE
        description: All Positions
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: cancel_orders
          in: query
          type: boolean
          description: If true is specified, cancel all open orders before liquidating all positions.
    - name: v2-positions-symbol_or_asset_id
      path: /v2/positions/{symbol_or_asset_id}
      operations:
      - name: getopenposition
        method: GET
        description: Open Position
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: deleteopenposition
        method: DELETE
        description: Position
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: qty
          in: query
          type: number
          description: the number of shares to liquidate. Can accept up to 9 decimal points. Cannot work with percentage
        - name: percentage
          in: query
          type: number
          description: percentage of position to liquidate. Must be between 0 and 100. Would only sell fractional if position
            is originally fractional. Can accept up to 9 decimal poin
    authentication:
      type: apikey
      key: APCA-API-KEY-ID
      value: '{{env.ALPACA_API_KEY}}'
      placement: header
  exposes:
  - type: rest
    namespace: trading-positions-rest
    port: 8080
    description: REST adapter for Trader API — Positions. One Spectral-compliant resource per consumed operation, prefixed
      with /v1.
    resources:
    - path: /v1/v2/positions
      name: v2-positions
      description: REST surface for v2-positions.
      operations:
      - method: GET
        name: getallopenpositions
        description: All Open Positions
        call: trading-positions.getallopenpositions
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: deleteallopenpositions
        description: All Positions
        call: trading-positions.deleteallopenpositions
        with:
          cancel_orders: rest.cancel_orders
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v2/positions/{symbol-or-asset-id}
      name: v2-positions-symbol-or-asset-id
      description: REST surface for v2-positions-symbol_or_asset_id.
      operations:
      - method: GET
        name: getopenposition
        description: Open Position
        call: trading-positions.getopenposition
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: deleteopenposition
        description: Position
        call: trading-positions.deleteopenposition
        with:
          qty: rest.qty
          percentage: rest.percentage
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: trading-positions-mcp
    port: 9090
    transport: http
    description: MCP adapter for Trader API — Positions. One tool per consumed operation, routed inline through this capability's
      consumes block.
    tools:
    - name: all-open-positions
      description: All Open Positions
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: trading-positions.getallopenpositions
      outputParameters:
      - type: object
        mapping: $.
    - name: all-positions
      description: All Positions
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: trading-positions.deleteallopenpositions
      with:
        cancel_orders: tools.cancel_orders
      outputParameters:
      - type: object
        mapping: $.
    - name: open-position
      description: Open Position
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: trading-positions.getopenposition
      outputParameters:
      - type: object
        mapping: $.
    - name: position
      description: Position
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: trading-positions.deleteopenposition
      with:
        qty: tools.qty
        percentage: tools.percentage
      outputParameters:
      - type: object
        mapping: $.