Thanks Dan, I appreciate the quick response.
I’m not sure this falls into the FIFO issue etc.. but maybe I’m not following that particular logic 100%.
My tests are very basic and straight forward. For the example I used earlier, I’ll expand a few points.
I don’t have outstanding open shares. My tests are very simple, I buy and then a few minutes later I sell leaving nothing outstanding.
This morning I had not executed any trades prior to this next step.
Then at 8:43am (central time, so while the market was open) I was bought 1 share of IBIT (ETF) for $49.73.
I then sold that that 1 share at 8:45am @ $49.77 and the daily change showed .01.
This shows up in the order dashboard for Alpaca as well as the response in the API with those same prices.
The orderid for the buy and then sell are:
795f8395-3c53-4ee4-9ffd-d7f9f60f1135
85fc0411-0ac1-4e10-916a-9d75e45d3fa1
This is a cut/paste from the dashboard:
IBIT
Market sell 1.00 1.00 49.77 filled access_key Mar 24, 2025, 08:45:00 AM Mar 24, 2025, 08:45:01 AM Mar 24, 2025, 03:00:00 PM
IBIT
Market buy 1.00 1.00 49.73 filled access_key Mar 24, 2025, 08:43:05 AM Mar 24, 2025, 08:43:06 AM Jun 20, 2025, 03:00:00 PM
And if I pull the orders via the API I get the same information as the dashboard.
On Friday I pulled all my orders and calculated the P/L for that day and it was different from the daily change by about 5 cents.
I guess the main question would be, if you take the order history (dashboard OR API) and run the P/L for the day, should that not accurately equal the daily change? Because it often is a few cents different.
Thanks
Ken