Portfolio History #

The portfolio history API returns the timeseries data for equity and profit loss information of the account.

Known issue with Portfolio History calculations

We have received feedback and are aware issues regarding data calculated with Portfolio History API which could lead to incorrect values for equity, profit_loss, and profit_loss_pct.

Please validate results for Portfolio History API and make sure values are consistent for your use case.

We will be revamping Portfolio History API soon and will be updated in the documentation accordingly.

Get the account portfolio history

GET /v2/account/portfolio/history
Returns timeseries data about equity and profit/loss (P/L) of the account in requested timespan.

Parameters

Query Parameters

Attribute Type Requirement Description
period string
Optional
The duration of the data in <number> + <unit>, such as 1D, where <unit> can be D for day, W for week, M for month and A for year. Defaults to 1M.
timeframe string
Optional
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.
date_end string<date>
Optional
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)
extended_hours bool
Optional
If true, include extended hours in the result. This is effective only for timeframe less than 1D.

Response

PortfolioHistory object

PortfolioHistory Entity #

Example #

{
  "timestamp": [1580826600000, 1580827500000, 1580828400000],
  "equity": [27423.73, 27408.19, 27515.97],
  "profit_loss": [11.8, -3.74, 104.04],
  "profit_loss_pct": [0.000430469507254688, -0.0001364369455197062, 0.0037954277571845543],
  "base_value": 27411.93,
  "timeframe": "15Min"
}

Properties #

Attribute Type Description
timestamp array of epoch int (in seconds) time of each data element, left-labeled (the beginning of time window)
equity array of number equity value of the account in dollar amount as of the end of each time window
profit_loss array of number profit/loss in dollar from the base value
profit_loss_pct array of number profit/loss in percentage from the base value
base_value number basis in dollar of the profit loss calculation
timeframe time window size of each data element