alpaca-py icon indicating copy to clipboard operation
alpaca-py copied to clipboard

fix: Incorrect documentation for timestamp property of PortfolioHistory model

Open fumoboy007 opened this issue 1 year ago • 5 comments

The timestamp is the end of the time window, not the start. I verified this by checking the API response against the timestamp of a cash deposit in my account.

For example:

  • The actual timestamp of the cash deposit was 2025-01-22T13:49:48-08:00.
  • get_portfolio_history with 1-hour granularity shows the cash deposit at timestamp 2025-01-22T14:00:00-08:00.

fumoboy007 avatar Jan 24 '25 02:01 fumoboy007

@fumoboy007 Thank you for the report. May I please ask the request parameters (GetPortfolioHistoryRequest) you are calling and approx time, also paper or live? The docstring is actually copied from API reference document [1]. Therefore, I would like to confirm the details.

*1 https://docs.alpaca.markets/reference/getaccountportfoliohistory-1

hiohiohio avatar Jan 24 '25 04:01 hiohiohio

May I please ask the request parameters (GetPortfolioHistoryRequest) you are calling and approx time, also paper or live?

https://api.alpaca.markets/v2/account/portfolio/history?timeframe=1H&intraday_reporting=continuous&start=2025-01-22T12%3A00%3A00-08%3A00&pnl_reset=per_day&end=2025-01-22T15%3A00%3A00-08%3A00&cashflow_types=ALL

The docstring is actually copied from API reference document.

Hmm interesting, I guess we need to update that documentation too. It would make more sense to be the end of the time window anyways because the equity property uses the value at the end of the time window.

fumoboy007 avatar Jan 24 '25 05:01 fumoboy007

(Probably a good idea to double-check the back-end code though.)

fumoboy007 avatar Jan 24 '25 07:01 fumoboy007

@fumoboy007 Thank you for the details. It really helps us to investigate. Agree to double-check the back-end code.

hiohiohio avatar Jan 24 '25 09:01 hiohiohio

@hiohiohio Any updates?

fumoboy007 avatar Feb 06 '25 20:02 fumoboy007