Class PortfolioHistoryApi
java.lang.Object
markets.alpaca.client.openapi.broker.api.PortfolioHistoryApi
Generated client for PortfolioHistoryApi operations.
This class is generated from the configured OpenAPI spec. Operation method Javadocs include OAS summaries, descriptions, parameters, return types, response details, and external documentation links when present in the spec.
Operations
getV1TradingAccountsAccountIdAccountPortfolioHistory: Get Account Portfolio History
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetV1TradingAccountsAccountIdAccountPortfolioHistory(UUID accountId, String period, PortfolioHistoryTimeframe timeframe, String intradayReporting, String start, String pnlReset, String end, String extendedHours, String cashflowTypes) Get Account Portfolio History Returns timeseries data about equity and profit/loss (P/L) of the account in requested timespan.okhttp3.CallgetV1TradingAccountsAccountIdAccountPortfolioHistoryAsync(UUID accountId, String period, PortfolioHistoryTimeframe timeframe, String intradayReporting, String start, String pnlReset, String end, String extendedHours, String cashflowTypes, ApiCallback<PortfolioHistory> _callback) Get Account Portfolio History (asynchronously) Returns timeseries data about equity and profit/loss (P/L) of the account in requested timespan.okhttp3.CallgetV1TradingAccountsAccountIdAccountPortfolioHistoryCall(UUID accountId, String period, PortfolioHistoryTimeframe timeframe, String intradayReporting, String start, String pnlReset, String end, String extendedHours, String cashflowTypes, ApiCallback _callback) Build call for getV1TradingAccountsAccountIdAccountPortfolioHistorygetV1TradingAccountsAccountIdAccountPortfolioHistoryWithHttpInfo(UUID accountId, String period, PortfolioHistoryTimeframe timeframe, String intradayReporting, String start, String pnlReset, String end, String extendedHours, String cashflowTypes) Get Account Portfolio History Returns timeseries data about equity and profit/loss (P/L) of the account in requested timespan.voidsetApiClient(ApiClient apiClient) voidsetCustomBaseUrl(String customBaseUrl) voidsetHostIndex(int hostIndex)
-
Constructor Details
-
PortfolioHistoryApi
public PortfolioHistoryApi() -
PortfolioHistoryApi
-
-
Method Details
-
getApiClient
-
setApiClient
-
getHostIndex
public int getHostIndex() -
setHostIndex
public void setHostIndex(int hostIndex) -
getCustomBaseUrl
-
setCustomBaseUrl
-
getV1TradingAccountsAccountIdAccountPortfolioHistoryCall
public okhttp3.Call getV1TradingAccountsAccountIdAccountPortfolioHistoryCall(@Nonnull UUID accountId, @Nullable String period, @Nullable PortfolioHistoryTimeframe timeframe, @Nullable String intradayReporting, @Nullable String start, @Nullable String pnlReset, @Nullable String end, @Nullable String extendedHours, @Nullable String cashflowTypes, ApiCallback _callback) throws ApiException Build call for getV1TradingAccountsAccountIdAccountPortfolioHistory- Parameters:
accountId- (required)period- 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. (optional)timeframe- 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`. (optional)intradayReporting- 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. (optional, default to market_hours)start- The first timestamp of the timeseries. Accepted formats: - ISO 8601 date stamp (e.g. \"2021-03-16\", parsed as UTC) - ISO 8601 datetime (e.g. \"2021-03-16T18:38:01Z\", \"2021-03-16T18:38:01-04:00\") - Unix timestamp 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. (optional)pnlReset- `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. (optional, default to per_day)end- The last timestamp of the timeseries. Accepted formats: - ISO 8601 date stamp (e.g. \"2021-03-16\", parsed as UTC) - ISO 8601 datetime (e.g. \"2021-03-16T18:38:01Z\", \"2021-03-16T18:38:01-04:00\") - Unix timestamp 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. (optional)extendedHours- **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. (optional)cashflowTypes- The cashflow activities to include in the report. One of 'ALL', 'NONE', or a comma-separated list of activity types. (optional)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object- HTTP Response Details:
Response Details Status Code Description Response Headers 200 Successful response. * Deprecated-Params -
401 Unauthorized (invalid or missing credentials). * Deprecated-Params -
403 Forbidden (the credentials are valid but lack the required grants or access to the requested account). * Deprecated-Params -
404 Account not found. * Deprecated-Params -
422 The request parameters are invalid. * Deprecated-Params -
429 Rate limit exceeded. * Deprecated-Params -
* Retry-After - Number of seconds to wait before retrying the request.
500 Unexpected server failure. * Deprecated-Params -
504 Gateway timeout. * Deprecated-Params -
-
getV1TradingAccountsAccountIdAccountPortfolioHistory
public PortfolioHistory getV1TradingAccountsAccountIdAccountPortfolioHistory(@Nonnull UUID accountId, @Nullable String period, @Nullable PortfolioHistoryTimeframe timeframe, @Nullable String intradayReporting, @Nullable String start, @Nullable String pnlReset, @Nullable String end, @Nullable String extendedHours, @Nullable String cashflowTypes) throws ApiException Get Account Portfolio History Returns timeseries data about equity and profit/loss (P/L) of the account in requested timespan.- Parameters:
accountId- (required)period- 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. (optional)timeframe- 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`. (optional)intradayReporting- 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. (optional, default to market_hours)start- The first timestamp of the timeseries. Accepted formats: - ISO 8601 date stamp (e.g. \"2021-03-16\", parsed as UTC) - ISO 8601 datetime (e.g. \"2021-03-16T18:38:01Z\", \"2021-03-16T18:38:01-04:00\") - Unix timestamp 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. (optional)pnlReset- `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. (optional, default to per_day)end- The last timestamp of the timeseries. Accepted formats: - ISO 8601 date stamp (e.g. \"2021-03-16\", parsed as UTC) - ISO 8601 datetime (e.g. \"2021-03-16T18:38:01Z\", \"2021-03-16T18:38:01-04:00\") - Unix timestamp 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. (optional)extendedHours- **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. (optional)cashflowTypes- The cashflow activities to include in the report. One of 'ALL', 'NONE', or a comma-separated list of activity types. (optional)- Returns:
- PortfolioHistory
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body- HTTP Response Details:
Response Details Status Code Description Response Headers 200 Successful response. * Deprecated-Params -
401 Unauthorized (invalid or missing credentials). * Deprecated-Params -
403 Forbidden (the credentials are valid but lack the required grants or access to the requested account). * Deprecated-Params -
404 Account not found. * Deprecated-Params -
422 The request parameters are invalid. * Deprecated-Params -
429 Rate limit exceeded. * Deprecated-Params -
* Retry-After - Number of seconds to wait before retrying the request.
500 Unexpected server failure. * Deprecated-Params -
504 Gateway timeout. * Deprecated-Params -
-
getV1TradingAccountsAccountIdAccountPortfolioHistoryWithHttpInfo
public ApiResponse<PortfolioHistory> getV1TradingAccountsAccountIdAccountPortfolioHistoryWithHttpInfo(@Nonnull UUID accountId, @Nullable String period, @Nullable PortfolioHistoryTimeframe timeframe, @Nullable String intradayReporting, @Nullable String start, @Nullable String pnlReset, @Nullable String end, @Nullable String extendedHours, @Nullable String cashflowTypes) throws ApiException Get Account Portfolio History Returns timeseries data about equity and profit/loss (P/L) of the account in requested timespan.- Parameters:
accountId- (required)period- 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. (optional)timeframe- 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`. (optional)intradayReporting- 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. (optional, default to market_hours)start- The first timestamp of the timeseries. Accepted formats: - ISO 8601 date stamp (e.g. \"2021-03-16\", parsed as UTC) - ISO 8601 datetime (e.g. \"2021-03-16T18:38:01Z\", \"2021-03-16T18:38:01-04:00\") - Unix timestamp 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. (optional)pnlReset- `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. (optional, default to per_day)end- The last timestamp of the timeseries. Accepted formats: - ISO 8601 date stamp (e.g. \"2021-03-16\", parsed as UTC) - ISO 8601 datetime (e.g. \"2021-03-16T18:38:01Z\", \"2021-03-16T18:38:01-04:00\") - Unix timestamp 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. (optional)extendedHours- **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. (optional)cashflowTypes- The cashflow activities to include in the report. One of 'ALL', 'NONE', or a comma-separated list of activity types. (optional)- Returns:
- ApiResponse<PortfolioHistory>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body- HTTP Response Details:
Response Details Status Code Description Response Headers 200 Successful response. * Deprecated-Params -
401 Unauthorized (invalid or missing credentials). * Deprecated-Params -
403 Forbidden (the credentials are valid but lack the required grants or access to the requested account). * Deprecated-Params -
404 Account not found. * Deprecated-Params -
422 The request parameters are invalid. * Deprecated-Params -
429 Rate limit exceeded. * Deprecated-Params -
* Retry-After - Number of seconds to wait before retrying the request.
500 Unexpected server failure. * Deprecated-Params -
504 Gateway timeout. * Deprecated-Params -
-
getV1TradingAccountsAccountIdAccountPortfolioHistoryAsync
public okhttp3.Call getV1TradingAccountsAccountIdAccountPortfolioHistoryAsync(@Nonnull UUID accountId, @Nullable String period, @Nullable PortfolioHistoryTimeframe timeframe, @Nullable String intradayReporting, @Nullable String start, @Nullable String pnlReset, @Nullable String end, @Nullable String extendedHours, @Nullable String cashflowTypes, ApiCallback<PortfolioHistory> _callback) throws ApiException Get Account Portfolio History (asynchronously) Returns timeseries data about equity and profit/loss (P/L) of the account in requested timespan.- Parameters:
accountId- (required)period- 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. (optional)timeframe- 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`. (optional)intradayReporting- 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. (optional, default to market_hours)start- The first timestamp of the timeseries. Accepted formats: - ISO 8601 date stamp (e.g. \"2021-03-16\", parsed as UTC) - ISO 8601 datetime (e.g. \"2021-03-16T18:38:01Z\", \"2021-03-16T18:38:01-04:00\") - Unix timestamp 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. (optional)pnlReset- `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. (optional, default to per_day)end- The last timestamp of the timeseries. Accepted formats: - ISO 8601 date stamp (e.g. \"2021-03-16\", parsed as UTC) - ISO 8601 datetime (e.g. \"2021-03-16T18:38:01Z\", \"2021-03-16T18:38:01-04:00\") - Unix timestamp 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. (optional)extendedHours- **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. (optional)cashflowTypes- The cashflow activities to include in the report. One of 'ALL', 'NONE', or a comma-separated list of activity types. (optional)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object- HTTP Response Details:
Response Details Status Code Description Response Headers 200 Successful response. * Deprecated-Params -
401 Unauthorized (invalid or missing credentials). * Deprecated-Params -
403 Forbidden (the credentials are valid but lack the required grants or access to the requested account). * Deprecated-Params -
404 Account not found. * Deprecated-Params -
422 The request parameters are invalid. * Deprecated-Params -
429 Rate limit exceeded. * Deprecated-Params -
* Retry-After - Number of seconds to wait before retrying the request.
500 Unexpected server failure. * Deprecated-Params -
504 Gateway timeout. * Deprecated-Params -
-