# Support or guidance for Total P&L, Realized + Unrealized

**URL:** <https://forum.alpaca.markets/t/support-or-guidance-for-total-p-l-realized-unrealized/2891>\
**Category:** App-Integration\
**Created:** [October 5, 2020, 5:39pm UTC](https://forum.alpaca.markets/t/support-or-guidance-for-total-p-l-realized-unrealized/2891 "2020-10-05T17:39:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sammp](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@sammp](https://forum.alpaca.markets/u/sammp)\
**Post date:** [October 5, 2020, 5:39pm UTC](https://forum.alpaca.markets/t/support-or-guidance-for-total-p-l-realized-unrealized/2891/1 "2020-10-05T17:39:23Z")

</div>

I am looking for some help with getting the Realized & Unrealized P&L (percentage, and total $) for a user’s account, from the beginning of their account.

I posted the following in the Slack:

I’m looking for a quick way to calculate the P/L % and $ total, over the duration of a user’s account.It seems that using the **/v2/account/portfolio/history** endpoint, would make sense for this.

In a simple case I’d get the **created\_at** date of the account, then query the above endpoint starting from the **created\_at** date of the account.I would then look for the first " **equity**" value returned (call it say, **startingVal** ), and I would look for the most recent " **equity**" value (call it **currentVal** )

Then the equation is simple: **((currentVal - startingVal) / currentVal) \* 100**

I think there is a flaw in this approach however, because it doesn’t account for cash transactions into (and out of) the user’s account. Does anyone have a better idea of how to formulate this?

A user answered:

> I run the same calc on my own portfolio, and you’re right - deposits/withdrawls just get blended in to the equity values.

The only idea I have to solve for this value is by using **/v2/account/activities** and parsing BUY/SELL/CASH-IN/CASH-OUT events, which I think could get pretty complicated.

Is there a better way to figure these values out with the current endpoints - if not, is there a possibility of simplifying this with some new schema?

Thanks.

---

<div class="post-metadata">

**Author:** ![MadTrader](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@MadTrader](https://forum.alpaca.markets/u/MadTrader)\
**Post date:** [August 30, 2025, 8:50pm UTC](https://forum.alpaca.markets/t/support-or-guidance-for-total-p-l-realized-unrealized/2891/2 "2025-08-30T20:50:54Z")

</div>

I second this. I think it would be a great if we had unrealized and realized to pull from an endpoint
