Get Account Portfolio History
GET {{baseUrl}}/v2/account/portfolio/history
Returns timeseries data about equity and profit/loss (P/L) of the account in requested timespan.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
period | string | 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
(or date_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
| string | | 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
| string | | For intraday resolutions (<1D) this specfies which timestamps to return data points for:
Allowed values are:
-
market_hours
Only timestamps for the core requity 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.
For 1D resolutions this specifies when to return the current value of the portfolio as the latest data point:
- market_hours
Append during the core trading hours (usually 9:30am to 4:00pm, trading days only)
-
extended_hours
Append during extended hours (usually 4:00am to 8:00pm, trading days only)
-
continuous
Always append the current equity value. | |
start
| string | | The timestamp the data is returned starting from in RFC3339 format (including timezone specification).
For timeframes
less than 1D, the actual start will be determined based on the value of the intraday_reporting
query parameter:
For example if the intraday_reporting
is extended_hours
, and the timestamp specified is 2023-10-19T03:30:00-04:00
, then the first
data point returned will be 2023-10-19T04:00:00-04:00
due to the session opening at that time.
start
, end
(or date_end
) and period
cannot be specified at the same time.
If unset, the period
will be used to calculate the starting time.
|
| pnl_reset
| string | | 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 it's continous 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 reseting the base value.
|
| end
| string | | The timestamp the data is returned up to in RFC3339 format (including timezone specification).
For timeframes
less than 1D, the actual start will be determined based on the value of the intraday_reporting
query parameter:
For example if the intraday_reporting
is extended_hours
, and the timestamp specified is 2023-10-19T21:33:00-04:00
, then the last
data point returned will be 2023-10-19T20:00:00-04:00
due to the session closing at that time.
start
, end
(or date_end
) and period
cannot be specified at the same time.
If unset, the current time is considered the end
's default value.
|
| date_end
| string | | deprecated: please use the end query parameter instead for better control of the time zone.
The date the data is returned up to, in “YYYY-MM-DD” format. Defaults to the current market date (rolls over at the market open if
extended_hours
is false, otherwise at 7am ET)
In continous mode, the returned data is starting from midnight the given day in ET.
|
| extended_hours
| string | | 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. |
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Accept | string | ||
Apca-Api-Key-Id | string | ||
Apca-Api-Secret-Key | string |
RESPONSES
status: OK
{"timestamp":[-15613929,72144222],"equity":[-82076591.38652174,-23091819.922244832],"profit_loss":[-64537654.18727104,-77438009.55564843],"profit_loss_pct":[0.001,0.002],"base_value":4640442.658932865,"timeframe":"15Min","base_value_asof":"2023-10-20"}