Get Account Portfolio History

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

Usage for equity-traders

By default, for timeframes less than 1D, the API returns the data points during market open times, to change this behavior the intraday_reporting query can be set to extended_hours, to include the premarket and after-hours trading prices.

Usage for crypto-traders

The API can be used both for crypto and equities trading accounts. By default the API is aiming at the equities trading use-case, however, it can be configured to return data more suited for visualizing crypto portfolios.

For crypto, we recommend setting the following flags:

  • intraday_reporting=continuous so that 24/7 graphs are returned
  • pnl_reset=no_reset so that the Profit And Loss calculation is continuous over the given period of time.

The timeframe can only be set to less than 1 day, when the requested period is less than 30 days.

Profit and loss calculation

For profit and loss calculation we are using simple profit and loss to calculate the pnl percentage for a given time:

pnl_pct = equity/base_value-1

base_value and base_value_asof typically corresponds to the first available datapoint and timestamp unless the first data point reflects a zero (0) value. Portfolio value may be zero if the account is new or is not funded as of the beginning of the time period reflected in the chart. If base_value_asof is omitted from the response, there are no non-zero values and portfolio has no value for the duration of the requested chart.

Notes

When intraday_reporting=continuous, equity calculations are based on 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.

When timeframe=1D, intraday_reporting has no effect and the response will only contain entries for days when the market is open.

All the cash values returned to two digits. All percentage values are rounded to 4 digits.

Query Params
string

The total duration of history being requested defined as number + unit.
Valid units are: D, W, M, and A (annum).

The following restrictions apply:

  • MUST NOT be included if both start and end are provided.
  • Default value is 1M when start or end is omitted.
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.

string
enum
Defaults to market_hours

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.

Allowed:
string

The first timestamp of the timeseries.

Defaults to end - period.

When timeframe=1D, if start occurs any time on a trading day (including outside of market hours), start is set to the closing time of the current trading day. Otherwise, start is rolled forward to the closing time of the next available trading day.

When timeframe != 1D, one of the following rules is applied.

  • When intraday_reporting=continuous, start is rolled back to the nearest timeframe interval.
  • When both start and end are omitted, start is rolled back to the first market/session open that is encountered.
  • When intraday_reporting != continuous and start is a trading day:
    • roll forward to the first market/session open if start is outside of market/session hours, or
    • roll back to the nearest timeframe interval if start occurs during trading hours.
  • Roll forward to the next market/session open if start does not fall on a trading day.

start may be combined with end or period, but cannot be combined with both.

string
enum
Defaults to per_day

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.

Allowed:
string

The last timestamp of the timeseries.

Defaults to start + period when start is provided.

When start and end are omitted, or if end is AFTER the request time, end defaults to

  • The most recent session open timestamp if intraday_reporting=extended_hours
  • The most recent market open timestamp if intraday_reporting=market_hours
  • The current timestamp if intraday_reporting=continuous

end may be combined with start or period, but cannot be combined with both.

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.

string

The cashflow activities to include in the report. One of 'ALL', 'NONE', or a comma-separated list of activity types.

Responses

Language
Credentials
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json