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
| Name | Required | Description | Default |
|---|---|---|---|
| period | No | The 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. | |
| timeframe | No | The 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_reporting | No | For 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 |
| start | No | The 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_reset | No | `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 |
| end | No | The 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_hours | No | **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_types | No | The cashflow activities to include in the report. One of 'ALL', 'NONE', or a comma-separated list of activity types. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||