Alpaca Trading API

The Alpaca Trading API enables commission-free trading of US-listed equities, options, and crypto. It exposes endpoints for orders, positions, account information, watchlists, calendar, clock, and assets. A paper trading sandbox is available at paper-api.alpaca.markets.

Operations 11

GET /v1/trading/accounts/{account_id}/positions List open positions for an account #
DELETE /v1/trading/accounts/{account_id}/positions Close All Positions for an Account #
GET /v1/trading/accounts/{account_id}/positions/{symbol_or_asset_id} Get an Open Position for account by Symbol or AssetId #
DELETE /v1/trading/accounts/{account_id}/positions/{symbol_or_asset_id} Close a Position for an Account #
GET /v1/trading/accounts/{account_id}/orders/{order_id} Retrieves a single order for the given order_id. #
PATCH /v1/trading/accounts/{account_id}/orders/{order_id} Replaces a single order with updated parameters #
DELETE /v1/trading/accounts/{account_id}/orders/{order_id} Attempts to cancel an open order. #
GET /v1/trading/accounts/{account_id}/orders Retrieves a list of orders for the account, filtered by the supplied query parameters. #
POST /v1/trading/accounts/{account_id}/orders Create an order for an account. #
DELETE /v1/trading/accounts/{account_id}/orders Attempts to cancel all open orders. A response will be provided for each order that is attempted to be cancelled. #
GET /v1/events/trades Subscribe to Trade Events (SSE) #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/trading-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

alpaca-trading-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Broker Trading API
  description: Open brokerage accounts, enable crypto and stock trading, and manage the ongoing user experience with Alpaca Broker API
  version: 1.0.0
  contact:
    name: Alpaca Support
    email: support@alpaca.markets
    url: https://alpaca.markets/support
  termsOfService: https://s3.amazonaws.com/files.alpaca.markets/disclosures/library/TermsAndConditions.pdf
servers:
- url: https://broker-api.sandbox.alpaca.markets
  description: Sandbox endpoint
- url: https://broker-api.alpaca.markets
  description: Production endpoint
security:
- BasicAuth: []
tags:
- name: Trading
paths:
  /v1/trading/accounts/{account_id}/positions:
    parameters:
    - $ref: '#/components/parameters/AccountID'
    get:
      summary: List open positions for an account
      tags:
      - Trading
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Position'
      operationId: getPositionsForAccount
      description: List open positions for an account
    delete:
      summary: Close All Positions for an Account
      operationId: closeAllPositionsForAccount
      responses:
        '207':
          description: HTTP 207 Multi-Status with body; an array of objects that include the order id and http status code for each status request.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PositionClosedResponse'
              examples:
                example-1:
                  value:
                  - symbol: TSLA
                    status: 200
                    body:
                      id: d1143025-89fc-4952-8936-db2409d899f3
                      client_order_id: 17dbfab4-cb86-4e0a-8fa6-f0606b0a9a4e
                      created_at: '2022-05-13T16:25:29.336330998Z'
                      updated_at: '2022-05-13T16:25:29.336330998Z'
                      submitted_at: '2022-05-13T16:25:29.335776073Z'
                      filled_at: null
                      expired_at: null
                      canceled_at: null
                      failed_at: null
                      replaced_at: null
                      replaced_by: null
                      replaces: null
                      asset_id: a4778bc8-fad1-47b7-87fe-d5cde10d43f4
                      symbol: TSLA
                      asset_class: us_equity
                      notional: null
                      qty: '4'
                      filled_qty: '0'
                      filled_avg_price: null
                      order_class: ''
                      order_type: market
                      type: market
                      side: sell
                      time_in_force: day
                      limit_price: null
                      stop_price: null
                      status: accepted
                      extended_hours: false
                      legs: null
                      trail_percent: null
                      trail_price: null
                      hwm: null
                      source: null
        '500':
          description: Failed to liquidate some positions
      description: Closes (liquidates) all of the account’s open long and short positions. A response will be provided for each order that is attempted to be cancelled. If an order is no longer cancelable, the server will respond with status 500 and reject the request.
      parameters:
      - schema:
          type: boolean
        in: query
        name: cancel_orders
        description: If true is specified, cancel all open orders before liquidating all positions.
      tags:
      - Trading
  /v1/trading/accounts/{account_id}/positions/{symbol_or_asset_id}:
    parameters:
    - $ref: '#/components/parameters/AccountID'
    - schema:
        type: string
      name: symbol_or_asset_id
      in: path
      required: true
      description: 'The symbol or asset_id '
    get:
      summary: Get an Open Position for account by Symbol or AssetId
      responses:
        '200':
          description: The requested Position object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Position'
        '404':
          description: 'Account doesn''t have a position for this symbol or asset_id '
      operationId: getPositionsForAccountBySymbol
      description: Retrieves the account’s open position for the given symbol or asset_id.
      tags:
      - Trading
    delete:
      summary: Close a Position for an Account
      operationId: closePositionForAccountBySymbol
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
      description: Closes (liquidates) the account’s open position for the given symbol. Works for both long and short positions.
      tags:
      - Trading
      parameters:
      - schema:
          type: string
        in: query
        name: qty
        description: Optional the number of shares to liquidate. Can accept up to 9 decimal points. Cannot work with percentage
      - schema:
          type: string
        in: query
        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 points. Cannot work with qty
        name: percentage
  /v1/trading/accounts/{account_id}/orders/{order_id}:
    parameters:
    - $ref: '#/components/parameters/AccountID'
    - $ref: '#/components/parameters/OrderID'
    get:
      summary: Retrieves a single order for the given order_id.
      tags:
      - Trading
      description: Retrieves a single order for the given order_id.
      responses:
        '200':
          description: The requested Order object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
      operationId: getOrderForAccount
    patch:
      summary: Replaces a single order with updated parameters
      tags:
      - Trading
      description: 'Replaces a single order with updated parameters. Each parameter overrides the corresponding attribute of the existing order. The other attributes remain the same as the existing order.


        A success return code from a replaced order does NOT guarantee the existing open order has been replaced. If the existing open order is filled before the replacing (new) order reaches the execution venue, the replacing (new) order is rejected, and these events are sent in the trade_updates stream channel found [here in the market data api](https://alpaca.markets/docs/api-references/market-data-api/#order-updates).


        While an order is being replaced, the account''s buying power is reduced by the larger of the two orders that have been placed (the old order being replaced, and the newly placed order to replace it). If you are replacing a buy entry order with a higher limit price than the original order, the buying power is calculated based on the newly placed order. If you are replacing it with a lower limit price, the buying power is calculated based on the old order.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOrderRequest'
      responses:
        '200':
          description: A new Order object with a new order_id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          description: Buying power or shares are not sufficient
        '404':
          $ref: '#/components/responses/NotFound'
      operationId: replaceOrderForAccount
    delete:
      summary: Attempts to cancel an open order.
      tags:
      - Trading
      description: 'Attempts to cancel an open order. If the order is no longer cancelable (for example if the status is "filled"), the server will respond with status 422, and reject the request.


        Upon acceptance of the cancel request, it returns status 204.'
      responses:
        '204':
          description: Success (No Content)
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
      operationId: deleteOrderForAccount
  /v1/trading/accounts/{account_id}/orders:
    parameters:
    - $ref: '#/components/parameters/AccountID'
    get:
      parameters:
      - name: status
        in: query
        description: Order status to be queried. open, closed or all. Defaults to open.
        schema:
          type: string
          enum:
          - open
          - closed
          - all
      - name: limit
        in: query
        description: The maximum number of orders in response. Defaults to 50 and max is 500.
        schema:
          type: integer
          example: 500
      - $ref: '#/components/parameters/After'
      - $ref: '#/components/parameters/Until'
      - $ref: '#/components/parameters/Direction'
      - schema:
          type: boolean
        in: query
        name: nested
        description: If true, the result will roll up multi-leg orders under the legs field of primary order.
      - $ref: '#/components/parameters/Symbols'
      summary: Retrieves a list of orders for the account, filtered by the supplied query parameters.
      tags:
      - Trading
      description: 'Retrieves a list of orders for the account, filtered by the supplied query parameters.


        Endpoint defaults to open orders if no parameters are provided.'
      responses:
        '200':
          description: Retrieves a list of orders for the account, filtered by the supplied query parameters.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Order'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
      operationId: getAllOrdersForAccount
    post:
      summary: Create an order for an account.
      tags:
      - Trading
      description: Create an order for an account.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrderRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      operationId: createOrderForAccount
    delete:
      summary: Attempts to cancel all open orders. A response will be provided for each order that is attempted to be cancelled.
      tags:
      - Trading
      description: Attempts to cancel all open orders. A response will be provided for each order that is attempted to be cancelled.
      responses:
        '207':
          description: HTTP 207 Multi-Status with body, which is an array of objects that include the order id, http status code and an order object for each cancellation request.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/OrderClosedResponse'
              examples:
                example-1:
                  value:
                  - id: 872994c5-0620-40ad-8ae0-f224b9948df5
                    status: 200
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
      operationId: deleteAllOrdersForAccount
  /v1/events/trades:
    parameters: []
    get:
      summary: Subscribe to Trade Events (SSE)
      tags:
      - Trading
      responses:
        '200':
          description: Connected. Events will now start streaming as long as you keep the connection open.
          content:
            text/event-stream:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TradeUpdateEvent'
      parameters:
      - name: since
        in: query
        schema:
          type: string
          format: date-time
        description: 'Format: YYYY-MM-DD'
      - name: until
        in: query
        schema:
          type: string
          format: date-time
        description: 'Format: YYYY-MM-DD'
      - name: since_id
        in: query
        schema:
          type: integer
      - name: until_id
        in: query
        schema:
          type: integer
      operationId: subscribeToTradeSSE
      description: 'The Events API provides event push as well as historical queries via SSE (server sent events).


        You can listen to events related to trade updates. Most market trades sent during market hours are filled instantly; you can listen to limit order updates through this endpoint.


        Historical events are streamed immediately if queried, and updates are pushed as events occur.


        Query Params Rules:

        - `since` required if `until` specified

        - `since_id` required if `until_id` specified

        - `since` and `since_id` can’t be used at the same time

        Behavior:

        - if `since` or `since_id` not specified this will not return any historic data

        - if `until` or `until_id` reached stream will end (status 200)


        ---


        Note for people using the clients generated from this OAS spec. Currently OAS-3 doesn''t have full support for representing SSE style responses from an API, so if you are using a generated client and don''t specify a `since` and `until` there is a good chance the generated clients will hang waiting for the response to end.


        If you require the streaming capabilities we recommend not using the generated clients for this specific usecase until the OAS-3 standards come to a consensus on how to represent this correcting in OAS-3.'
components:
  schemas:
    CreateOrderRequest:
      type: object
      description: ''
      properties:
        symbol:
          type: string
          example: AAPL
          description: Symbol or asset ID to identify the asset to trade
        qty:
          type: string
          format: decimal
          example: '4.124'
          description: Number of shares to trade. Can be fractionable for only market and day order types.
        notional:
          type: string
          format: decimal
          example: '3'
          description: Dollar amount to trade. Cannot work with qty. Can only work for market order types and time_in_force = day.
        side:
          $ref: '#/components/schemas/OrderSide'
        type:
          $ref: '#/components/schemas/OrderType'
        time_in_force:
          $ref: '#/components/schemas/TimeInForce'
        limit_price:
          type: string
          format: decimal
          example: '3.14'
          description: Required if type is limit or stop_limit
        stop_price:
          type: string
          format: decimal
          example: '3.14'
          description: Required if type is stop or stop_limit
        trail_price:
          type: string
          format: decimal
          example: '3.14'
          description: If type is trailing_stop, then one of trail_price or trail_percent is required
        trail_percent:
          type: string
          format: decimal
          example: '5.0'
          description: If type is trailing_stop, then one of trail_price or trail_percent is required
        extended_hours:
          type: boolean
          example: false
          description: Defaults to false. If true, order will be eligible to execute in premarket/afterhours. Only works with type limit and time_in_force = day.
        client_order_id:
          type: string
          example: eb9e2aaa-f71a-4f51-b5b4-52a6c565dad4
          description: A unique identifier for the order. Automatically generated if not sent. (<= 48 characters)
          maxLength: 48
        order_class:
          $ref: '#/components/schemas/OrderClass'
        take_profit:
          type: object
          description: Takes in a string/number value for limit_price
          properties:
            limit_price:
              type: string
              format: decimal
              example: '3.14'
        stop_loss:
          description: Takes in a string/number values for stop_price and limit_price
          type: object
          properties:
            stop_price:
              type: string
              format: decimal
              example: '3.14'
            limit_price:
              type: string
              format: decimal
              example: '3.14'
        commission:
          type: string
          format: decimal
          example: '1.0'
          description: The commission you want to collect from the user.
      required:
      - symbol
      - side
      - type
      - time_in_force
    PositionClosedResponse:
      title: PositionClosedResponse
      type: object
      description: 'Represents the result of asking the api to close a position.


        `body` is the Order used to close out the position.'
      x-examples:
        example-1:
          symbol: AAPL
          status: 200
          body:
            id: f7f25e89-939a-4587-aaf6-414a6b3c341d
            client_order_id: 52f8574c-96d5-49b6-94c1-2570a268434e
            created_at: '2022-02-04T16:53:29.53427917Z'
            updated_at: '2022-02-04T16:53:29.53427917Z'
            submitted_at: '2022-02-04T16:53:29.533738219Z'
            filled_at: null
            expired_at: null
            canceled_at: null
            failed_at: null
            replaced_at: null
            replaced_by: null
            replaces: null
            asset_id: b0b6dd9d-8b9b-48a9-ba46-b9d54906e415
            symbol: AAPL
            asset_class: us_equity
            notional: null
            qty: '2'
            filled_qty: '0'
            filled_avg_price: null
            order_class: ''
            order_type: market
            type: market
            side: sell
            time_in_force: day
            limit_price: null
            stop_price: null
            status: accepted
            extended_hours: false
            legs: null
            trail_percent: null
            trail_price: null
            hwm: null
            commision: '1.0'
      properties:
        symbol:
          type: string
          description: Symbol name of the asset
        status:
          type: integer
          description: Http status code for the attempt to close this position
        body:
          $ref: '#/components/schemas/Order'
      required:
      - symbol
      - status
    TradeUpdateEvent:
      description: Represents an update to an order/trade, sent over the events streaming api.
      type: object
      title: TradeUpdateEvent
      x-examples:
        example-1:
          account_id: 529248ad-c4cc-4a50-bea4-6bfd2953f83a
          at: '2022-04-19T14:12:30.656741Z'
          event: new
          event_id: 37782
          execution_id: 7e544af3-3104-4e1a-8cbc-dab2624949ff
          order:
            asset_class: us_equity
            asset_id: a4778bc8-fad1-47b7-87fe-d5cde10d43f4
            cancel_requested_at: null
            canceled_at: null
            client_order_id: 6d873193-dac6-4f72-8e13-c57853a9339d
            commission: '1'
            created_at: '2022-04-19T10:12:30.57117938-04:00'
            expired_at: null
            extended_hours: false
            failed_at: null
            filled_at: null
            filled_avg_price: null
            filled_qty: '0'
            hwm: null
            id: edada91a-8b55-4916-a153-8c7a9817e708
            legs: null
            limit_price: '700'
            notional: null
            order_class: ''
            order_type: limit
            qty: '4'
            replaced_at: null
            replaced_by: null
            replaces: null
            side: buy
            status: new
            stop_price: null
            submitted_at: '2022-04-19T10:12:30.403135025-04:00'
            symbol: TSLA
            time_in_force: day
            trail_percent: null
            trail_price: null
            type: limit
            updated_at: '2022-04-19T10:12:30.609783218-04:00'
          timestamp: '2022-04-19T14:12:30.602193534Z'
      properties:
        account_id:
          type: string
          minLength: 1
          description: Account UUID
          format: uuid
        at:
          type: string
          minLength: 1
          description: Timestamp of event
          format: date-time
        event:
          $ref: '#/components/schemas/TradeUpdateEventType'
        event_id:
          type: integer
          format: int64
          description: Monotonically increasing 64bit integer
        execution_id:
          type: string
          description: Corresponding execution of an order. If an order gets filled over two executions (a partial_fill for example), you will receive two events with different IDs.
          format: uuid
        order:
          $ref: '#/components/schemas/Order'
        timestamp:
          type: string
          description: 'Has various different meanings depending on the value of `event`, please see the [Trading Events](https://alpaca.markets/docs/api-references/broker-api/events/#trade-events)

            Enum in the documentation or the TradeUpdateEventType model for more details on when it means different things.

            '
          format: date-time
      required:
      - account_id
      - at
      - event
      - event_id
      - execution_id
      - order
      - timestamp
    TradeUpdateEventType:
      type: string
      description: "**Common events**\n\nThese are the events that are the expected results of actions you may have taken by sending API requests.\n\nThe meaning of the `timestamp` field changes for each type; the meanings have been specified here for which types the\ntimestamp field will be present.\n\n- `new`: Sent when an order has been routed to exchanges for execution.\n- `fill`: Sent when your order has been completely filled.\n  - `timestamp`: The time at which the order was filled.\n- `partial_fill`: Sent when a number of shares less than the total remaining quantity on your order has been filled.\n  - `timestamp`: The time at which the shares were filled.\n- `canceled`: Sent when your requested cancellation of an order is processed.\n  - `timestamp`: The time at which the order was canceled.\n- `expired`: Sent when an order has reached the end of its lifespan, as determined by the order’s time in force value.\n  - `timestamp`: The time at which the order expired.\n- `done_for_day`: Sent when the order is done executing for the day, and will not receive further updates until the next trading day.\n- `replaced`: Sent when your requested replacement of an order is processed.\n  - `timestamp`: The time at which the order was replaced.\n\n**Rarer events**\n\nThese are events that may rarely be sent due to unexpected circumstances on the exchanges. It is unlikely you will need to design your code around them, but you may still wish to account for the possibility that they will occur.\n\n- `rejected`: Sent when your order has been rejected.\n  - `timestamp`: The time at which the rejection occurred.\n- `pending_new`: Sent when the order has been received by Alpaca and routed to the exchanges, but has not yet been accepted for execution.\n- `stopped`: Sent when your order has been stopped, and a trade is guaranteed for the order, usually at a stated price or better, but has not yet occurred.\n- `pending_cancel`: Sent when the order is awaiting cancellation. Most cancellations will occur without the order entering this state.\n- `pending_replace`: Sent when the order is awaiting replacement.\n- `calculated`: Sent when the order has been completed for the day - it is either `filled` or `done_for_day` - but remaining settlement calculations are still pending.\n- `suspended`: Sent when the order has been suspended and is not eligible for trading.\n- `order_replace_rejected`: Sent when the order replace has been rejected.\n- `order_cancel_rejected`: Sent when the order cancel has been rejected.\n"
      enum:
      - new
      - fill
      - partial_fill
      - canceled
      - expired
      - done_for_day
      - replaced
      - rejected
      - pending_new
      - stopped
      - pending_cancel
      - pending_replace
      - calculated
      - suspended
      - order_replace_rejected
      - order_cancel_rejected
    OrderClass:
      type: string
      enum:
      - simple
      - bracket
      - oco
      - oto
      example: bracket
    OrderType:
      type: string
      enum:
      - market
      - limit
      - stop
      - stop_limit
      - trailing_stop
      example: stop
    Position:
      description: ''
      type: object
      x-examples:
        example-1:
          asset_id: 93f58d0b-6c53-432d-b8ce-2bad264dbd94
          symbol: AAPL
          exchange: NASDAQ
          asset_class: us_equity
          asset_marginable: false
          qty: '4'
          avg_entry_price: '172.08'
          side: long
          market_value: '688.32'
          cost_basis: '688.32'
          unrealized_pl: '0'
          unrealized_plpc: '0'
          unrealized_intraday_pl: '0'
          unrealized_intraday_plpc: '0'
          current_price: '172.08'
          lastday_price: '168.88'
          change_today: '0.0189483657034581'
      properties:
        asset_id:
          type: string
          example: 904837e3-3b76-47ec-b432-046db621571b
          format: uuid
          description: Asset ID
        symbol:
          type: string
          example: AAPL
          description: Asset symbol
        exchange:
          type: string
          example: NASDAQ
          description: Exchange name of the asset
        asset_class:
          $ref: '#/components/schemas/AssetClass'
        asset_marginable:
          type: boolean
          description: Indicates if this asset is marginable
        avg_entry_price:
          type: string
          example: '100.0'
          description: Average entry price of the position
        qty:
          type: string
          example: '5'
          description: The number of shares
        side:
          type: string
          example: long
          enum:
          - long
          - short
        market_value:
          type: string
          format: decimal
          example: '600.0'
          description: Total dollar amount of the position
        cost_basis:
          type: string
          format: decimal
          example: '500.0'
          description: Total cost basis in dollar
        unrealized_pl:
          type: string
          format: decimal
          example: '100.0'
          description: Unrealized profit/loss in dollars
        unrealized_plpc:
          type: string
          format: decimal
          example: '0.20'
          description: Unrealized profit/loss percent (by a factor of 1)
        unrealized_intraday_pl:
          type: string
          format: decimal
          example: '10.0'
          description: Unrealized profit/loss in dollars for the day
        unrealized_intraday_plpc:
          type: string
          format: decimal
          example: '0.0084'
          description: Unrealized interday profit/loss percent (by a factor of 1)
        current_price:
          type: string
          format: decimal
          example: '120.0'
          description: Current asset price per share
        lastday_price:
          type: string
          format: decimal
          example: '119.0'
          description: Last day’s asset price per share based on the closing value of the last trading day
        change_today:
          type: string
          format: decimal
          example: '0.0084'
          description: Percent change from last day price (by a factor of 1)
      required:
      - asset_id
      - symbol
      - exchange
      - asset_class
      - avg_entry_price
      - qty
      - side
      - market_value
      - cost_basis
      - unrealized_pl
      - unrealized_plpc
      - unrealized_intraday_pl
      - unrealized_intraday_plpc
      - current_price
      - lastday_price
      - change_today
    OrderClosedResponse:
      title: OrderClosedResponse
      type: object
      description: 'Represents the result of asking the api to cancel an Order.

        '
      x-examples: {}
      properties:
        id:
          type: string
          description: UUID of the order that was canceled
          format: uuid
        status:
          type: integer
          description: Http status code for the attempt to close this Order
        body:
          $ref: '#/components/schemas/Order'
      required:
      - id
      - status
    TimeInForce:
      type: string
      enum:
      - day
      - gtc
      - opg
      - cls
      - ioc
      - fok
      example: gtc
    Order:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: 61e69015-8549-4bfd-b9c3-01e75843f47d
        client_order_id:
          type: string
          example: 61e69015-8549-4bfd-b9c3-01e75843f47d
        created_at:
          type: string
          format: date-time
          example: '2021-03-16T18:38:01.942282Z'
        updated_at:
          type: string
          format: date-time
          example: '2021-03-16T18:38:01.942282Z'
        submitted_at:
          type: string
          format: date-time
          example: '2021-03-16T18:38:01.942282Z'
        filled_at:
          type:
          - string
          - 'null'
          format: date-time
          example: '2021-03-16T18:38:01.942282Z'
        expired_at:
          type:
          - string
          - 'null'
          format: date-time
          example: '2021-03-16T18:38:01.942282Z'
        canceled_at:
          type:
          - string
          - 'null'
          format: date-time
          example: '2021-03-16T18:38:01.942282Z'
        failed_at:
          type:
          - string
          - 'null'
          format: date-time
          example: '2021-03-16T18:38:01.942282Z'
        replaced_at:
          type:
          - string
          - 'null'
          format: date-time
          example: '2021-03-16T18:38:01.942282Z'
        replaced_by:
          type:
          - string
          - 'null'
          format: uuid
          example: 61e69015-8549-4bfd-b9c3-01e75843f47d
        replaces:
          type:
          - string
          - 'null'
          format: uuid
          example: 61e69015-8549-4bfd-b9c3-01e75843f47d
        asset_id:
          type: string
          format: uuid
          example: 61e69015-8549-4bfd-b9c3-01e75843f47d
        symbol:
          type: string
          example: AALP
        asset_class:
          $ref: '#/components/schemas/AssetClass'
        notional:
          type:
          - string
          - 'null'
          format: decimal
          example: '4.2'
        qty:
          type:
          - string
          - 'null'
          format: decimal
          example: '4.2'
        filled_qty:
          type: string
          format: decimal
          example: '4.2'
        filled_avg_price:
          type:
          - string
          - 'null'
          format: decimal
          example: '4.2'
        order_class:
          $ref: '#/components/schemas/OrderClass'
        order_type:
          $ref: '#/components/schemas/OrderType'
        type:
          $ref: '#/components/schemas/OrderType'
        side:
          $ref: '#/components/schemas/OrderSide'
        time_in_force:
          $ref: '#/components/schemas/TimeInForce'
        limit_price:
          type:
          - string
          - 'null'
          format: decimal
          example: '3.14'
        stop_price:
          type:
          - string
          - 'null'
          format: decimal
          example: '3.14'
        status:
          $ref: '#/components/schemas/OrderStatus'
 

# --- truncated at 32 KB (36 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/alpaca/refs/heads/main/openapi/alpaca-trading-api-openapi.yml