Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Cash Flow Data in portfolio_history API to Adjust for Daily Return Calculations #263

Open
nainiayoub opened this issue Oct 6, 2024 · 1 comment

Comments

@nainiayoub
Copy link

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.

@xavierrobitaille
Copy link

or... use a portfolio management system. Check out the partner apps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants