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

# get_portfolio_history

> Get Alpaca portfolio history for the configured account.

## alpaca\_get\_portfolio\_history

```python
tools = trading.alpaca(
    api_key=os.environ["ALPACA_KEY"],
    api_secret=os.environ["ALPACA_SECRET"],
    model="openai",
    paper=True,
    minimal=True,
    include=["alpaca_get_portfolio_history"],
)
```

**Options**

* `include` / `exclude`: filter which tools are exposed (use full names like `alpaca_get_portfolio_history`).
* `minimal`: omit `provider` and `provider_fields` when `True`.
* `paper`: use Alpaca paper trading instead of live trading.


## OpenAPI

````yaml api-reference/openapi.json get /tools/alpaca/get_portfolio_history
openapi: 3.1.0
info:
  title: OpenTools Trading Tools
  version: 0.1.0
  description: >-
    Reference for OpenTools trading tool calls. These are SDK tools, documented
    as virtual endpoints for clarity.
servers: []
security: []
tags:
  - name: Alpaca
    description: >-
      Read-only account + assets + clock + orders + portfolio history +
      positions.
  - name: Coinbase
    description: >-
      Accounts + portfolios + portfolio breakdown + positions (derived) +
      brokerage products + orders (if available).
paths:
  /tools/alpaca/get_portfolio_history:
    get:
      tags:
        - Alpaca
      summary: get_portfolio_history
      description: Get Alpaca portfolio history for the configured account.
      operationId: alpaca_get_portfolio_history
      requestBody:
        required: false
        description: This is a request to obtain information. Your API keys are required.
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                period:
                  type: string
                  description: Duration like '1D', '1W', '1M', '3M', '1A'.
                timeframe:
                  type: string
                  description: 'Resolution: ''1Min'', ''5Min'', ''15Min'', ''1H'', ''1D''.'
                intraday_reporting:
                  type: string
                  description: Intraday reporting mode (provider dependent).
                start:
                  type: string
                  description: Start timestamp (RFC3339).
                end:
                  type: string
                  description: End timestamp (RFC3339).
                pnl_reset:
                  type: string
                  description: PnL reset mode (provider dependent).
                cashflow_types:
                  type: string
                  description: Cashflow filter (provider dependent).
            example:
              period: 1D
              timeframe: 1H
      responses:
        '200':
          description: PortfolioHistory (OpenTools trading schema).
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                description: ''
                properties:
                  provider:
                    type:
                      - string
                      - 'null'
                    description: Trading provider identifier. Omitted when minimal=True.
                  timeframe:
                    type:
                      - string
                      - 'null'
                    description: >-
                      Timeframe / resolution used for sampling (e.g. '1Min',
                      '1H', '1D').
                  base_value:
                    type:
                      - number
                      - 'null'
                    description: Starting equity value used as a baseline for P&L.
                  base_value_asof:
                    type:
                      - string
                      - 'null'
                    format: date-time
                    description: Timestamp corresponding to base_value.
                  points:
                    type: array
                    description: Equity and P&L points over time.
                    items:
                      type: object
                      additionalProperties: false
                      properties:
                        timestamp:
                          type: string
                          format: date-time
                          description: Point timestamp.
                        equity:
                          type: number
                          description: Equity value at timestamp.
                        profit_loss:
                          type:
                            - number
                            - 'null'
                          description: Profit/loss at timestamp.
                        profit_loss_pct:
                          type:
                            - number
                            - 'null'
                          description: >-
                            Profit/loss percent at timestamp (factor of 1, not
                            100).
                    default: []
                  provider_fields:
                    type: object
                    additionalProperties: true
                    description: >-
                      Additional provider-specific fields. Omitted when
                      minimal=True.
                examples:
                  - provider: <string>
                    timeframe: <string>
                    base_value: 1234.56
                    base_value_asof: '2023-11-07T05:31:56Z'
                    points:
                      - timestamp: '2023-11-07T05:31:56Z'
                        equity: 1234.56
                        profit_loss: 12.34
                        profit_loss_pct: 0.01
                    provider_fields: {}
        '401':
          description: Unauthorized (missing/invalid credentials).
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  message:
                    type: string
                  domain:
                    type: string
                  provider:
                    type: string
                  details: {}
                required:
                  - message
        '429':
          description: Rate limited by provider or transport.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  message:
                    type: string
                  domain:
                    type: string
                  provider:
                    type: string
                  details: {}
                required:
                  - message
      x-codeSamples:
        - lang: python
          label: Python
          source: |
            import os
            from opentools import trading

            tools = trading.alpaca(
                api_key=os.environ["ALPACA_KEY"],
                api_secret=os.environ["ALPACA_SECRET"],
                model="openai",
                paper=True,
                minimal=True,
                include=["alpaca_get_portfolio_history"],
            )

````