Bug in the portfolio equity and P&L calculations

There appears to be an instability in the portfolio equity and P&L calculations. It shows up in the browser GUI as I note here: Equity vs graphed value in the browser GUI. But something is off about the output of the api.get_portfolio_history() call also: image

Second and fourth rows in the table above seem to be calculated correctly but the 3rd row is not, i.e. 9.893342e+05 / 9.920640e+05 - 1 != -0.024411

Anyone else is experiencing this? Can it have something to do with how the trades are settled?

I think this is an important issue that should get developers’ attention. I am using the paper trading mode to assess how my strategy performs with Alpaca. Getting unexpected results from the portfolio history and P&L APIs is the reason I am thinking of sticking with my current broker, or continuing exploring other options. There’s a lot to like about Alpaca but this might be a deal breaker for me. I imagine for others as well.