Does Alpaca provide a direct API endpoint that gives you all the historical buy orders contributing to an open position?
Not in my knowledge. But you can always get orders using the query listed here and check which of these correspond to your interested instrument. Note that this query returns only 500 entries, but you can always get even earlier ones iteratively (pretty easy to do that in Python).
The answer is No. Alpaca does not provide a direct API endpoint that returns all historical buy orders contributing to an open position in a single response.
The Alpaca /positions
endpoint tells you the current open positions, including:
- quantity
- average entry price
- market value
- unrealized P/L
But it does not list each individual buy order that contributed to that position.