Is your feature request related to a problem? Please describe.
Yes, the problem arises when there’s a significant deposit or withdrawal in an Alpaca account, which skews the daily return calculation retrieved through the portfolio_history API. To properly calculate daily returns based solely on portfolio performance, I need to exclude cash flows (deposits/withdrawals). However, the portfolio_history endpoint does not provide direct information about these cash flows, making it difficult to adjust calculations accurately.
Describe the solution you'd like
I would like the portfolio_history API to include fields or provide data for cash flows (deposits/withdrawals), so that I can automatically account for these in the daily return calculations without manual tracking. This would allow users to calculate returns that focus solely on portfolio performance, without distortions from cash movements.
Describe alternatives you've considered
The primary alternative is to manually track deposits and withdrawals outside of the account history, then subtract them from the equity to calculate adjusted returns. However, this approach is prone to errors. Another option would be to build external tools to log and integrate cash flows, but having this data available directly in the API would be far more efficient and accurate.
Additional context
This feature would be especially helpful for users who rely on the API to monitor portfolio performance daily and want to ensure accurate return calculations even when there are large cash inflows or outflows.
Is your feature request related to a problem? Please describe. Yes, the problem arises when there’s a significant deposit or withdrawal in an Alpaca account, which skews the daily return calculation retrieved through the portfolio_history API. To properly calculate daily returns based solely on portfolio performance, I need to exclude cash flows (deposits/withdrawals). However, the portfolio_history endpoint does not provide direct information about these cash flows, making it difficult to adjust calculations accurately.
Describe the solution you'd like I would like the portfolio_history API to include fields or provide data for cash flows (deposits/withdrawals), so that I can automatically account for these in the daily return calculations without manual tracking. This would allow users to calculate returns that focus solely on portfolio performance, without distortions from cash movements.
Describe alternatives you've considered The primary alternative is to manually track deposits and withdrawals outside of the account history, then subtract them from the equity to calculate adjusted returns. However, this approach is prone to errors. Another option would be to build external tools to log and integrate cash flows, but having this data available directly in the API would be far more efficient and accurate.
Additional context This feature would be especially helpful for users who rely on the API to monitor portfolio performance daily and want to ensure accurate return calculations even when there are large cash inflows or outflows.