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.
Any position changes (splits, JNLS, etc.) happening for an equity position off-session hours are accounted for at the next session open. Crypto position changes are applied immediately.
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 returnedpnl_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
Profit and loss is calculated as:
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.