Skip to main content
Glama
alpacahq

alpaca-mcp-server

Official
by alpacahq

get_portfolio_history

Retrieve account portfolio history including equity and profit/loss data over customizable time windows with flexible resolution options for performance tracking.

Instructions

Retrieves account portfolio history (equity and P/L) over a requested time window.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNoThe duration of the data in `number` + `unit` format, such as 1D, where `unit` can be D for day, W for week, M for month and A for year. Defaults to 1M. Only two of `start`, `end` and `period` can be specified at the same time. For intraday timeframes (\<1D) only 30 days or less can be queried, for 1D resolutions there is no such limit, data is available since the creation of the account.
timeframeNoThe resolution of time window. 1Min, 5Min, 15Min, 1H, or 1D. If omitted, 1Min for less than 7 days period, 15Min for less than 30 days, or otherwise 1D. For queries with longer than 30 days of `period`, the system only accepts 1D as `timeframe`.
intraday_reportingNoFor intraday resolutions (<1D) this specifies which timestamps to return data points for: Allowed values are: - **market_hours** Only timestamps for the core equity trading hours are returned (usually 9:30am to 4:00pm, trading days only) - **extended_hours** Returns timestamps for the whole session including extended hours (usually 4:00am to 8:00pm, trading days only) - **continuous** Returns price data points 24/7 (for off-session times too). To calculate the equity values we are using the following prices: Between 4:00am and 10:00pm on trading days the valuation will be calculated based on the last trade (extended hours and normal hours respectively). After 10:00pm, until the next session open the equities will be valued at their official closing price on the primary exchange. market_hours
startNoThe timestamp the data is returned starting from in RFC3339 format (including timezone specification). Defaults to `end` minus `period` If provided, the `start` value is always normalized to the `America/New_York` timezone and adjusted to the nearest `timeframe` interval, e.g. seconds are always truncated and the time is rounded backwards to the nearest interval of `1Min`, `5Min`, `15Min`, or `1H`. If `timeframe=1D` and `start` is not a valid trading date, find the next available trading date. For example, if `start` occurs on Saturday or Sunday after converting to the America/New_York timezone, `start` is adjusted to the first weekday that is not a market holiday (e.g. Monday). If `timeframe` is less than `1D` and `intraday_reporting` is not `continuous`, `start` always reflects the beginning of a market session. If `start` is between midnight and the end (inclusive) of an active trading day, `start` is set to the beginning of the session on the specified day. Otherwise, if `start` occurs outside of the market session, the next available market date is used. For example, when `intraday_reporting=market_hours` and `start=2023-10-19T23:59:59-04:00`, the provided `start` date occurs outside of the regular market session. The effective `start` timestamp is adjusted to the beginning of the next session: `2023-10-20T09:30:00-04:00` `start` may be be combined with one of `end` or `period`. Providing all of `start`, `end`, and `period` is invalid.
pnl_resetNo`pnl_reset` defines how we are calculating the baseline values for Profit And Loss (pnl) for queries with `timeframe` less than 1D (intraday queries). The default behavior for intraday queries is that we reset the pnl value to the previous day's closing equity for each **trading** day. In case of crypto (given its continuous nature), this might not be desired: specifying "no_reset" disables this behavior and all pnl values returned will be relative to the closing equity of the previous trading day. For 1D resolution all PnL values are calculated relative to the `base_value`, we are not resetting the base value. per_day
endNoThe timestamp the data is returned up to in RFC3339 format (including timezone specification). Defaults to the current time. If provided, the `end` value is always normalized to the `America/New_York` timezone and adjusted to the nearest `timeframe` interval, e.g. seconds are always truncated and the time is rounded backwards to the nearest interval of `1Min`, `5Min`, `15Min`, or `1H`. When `intraday_reporting` is either `market_hours` or `extended_hours`, the `end` value is adjusted to not occur after session close on the specified day. For example if the `intraday_reporting` is `extended_hours`, and the timestamp specified is `2023-10-19T21:33:00-04:00`, `end` is adjusted to `2023-10-19T20:00:00-04:00`. `end` may be combined with `start` or `period`. Providing all of `start`, `end`, and `period` is invalid.
extended_hoursNo**deprecated**: Users are strongly advised to **rely on the `intraday_reporting` query parameter** for better control of the reporting range. If true, include extended hours in the result. This is effective only for timeframe less than 1D.
cashflow_typesNoThe cashflow activities to include in the report. One of 'ALL', 'NONE', or a comma-separated list of activity types.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves data, implying a read-only operation, but does not disclose important behavioral traits such as rate limits, authentication requirements, error handling, or whether it's idempotent. For a tool with 8 parameters and complex time-based logic, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. It states exactly what the tool does without redundancy or fluff, making it easy to parse and understand quickly. Every word earns its place, adhering to best practices for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (8 parameters, time-based logic) and the presence of an output schema, the description is minimally adequate. It covers the basic purpose but lacks depth in behavioral context, usage guidelines, and integration with sibling tools. With no annotations and rich schema details, the description should do more to guide the agent, but the output schema mitigates some completeness needs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, meaning all parameters are well-documented in the input schema. The description adds no additional meaning beyond the schema, as it only mentions 'requested time window' without detailing parameters like 'period' or 'timeframe'. Given the high schema coverage, the baseline score of 3 is appropriate, as the description does not compensate but also does not detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Retrieves account portfolio history (equity and P/L) over a requested time window.' It specifies the verb ('Retrieves'), resource ('account portfolio history'), and scope ('over a requested time window'), making it easy to understand. However, it does not explicitly differentiate from sibling tools like 'get_account_activities' or 'get_account_info', which might also retrieve account-related data, so it misses full sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention any prerequisites, exclusions, or comparisons to sibling tools such as 'get_account_activities' or 'get_stock_bars', which could be used for similar historical data. This lack of context leaves the agent without explicit usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/alpacahq/alpaca-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server