Daily proft/loss mismatch between activities and equity values

Environment

python 3.10

Alpaca SDK Version
alpaca-trade-api 2.3.0

Problem

Hi,

After every trading day, I take a look at my daily profit/loss. For this, I check calculate this value from 2 sources:

  1. From all of today’s activities, by calculating how much I bought and sold. I retrieve today’s activities with: .get_activities(activity_types=‘FILL’, date=date_today)

  2. My equity at the beginning and at the end of the day. I retrieve this with: .get_account().equity

For a long time now, I have encountered a mismatch between 1) and 2). What’s more, when I look at the dashboard on the website, it matches what I get from 2), but it also changes wildly after hours and overnight, when I make no trades and hold no positions (I close all my positions every day).

Could someone please explain to me what is going on? Is it something that I am doing, or is this a bug in the website?
Which results should I trust?
Does this happen in live trading? I don’t feel comfortable trading real money until fundamental yet straightforward issues like my daily profit/loss are working smoothly.

Thank you

Paper or Live Trading?
Paper

1 Like

@buysell, do you have any open positions at the beginning of the day when you take your equity snapshot? If so, your P/L for the day is the sum of 1) open_positions * price_change + 2) pl_on_new_activities.

You could try analyzing your P/L in Feather Finance, an Alpaca partner app. Feather Finance has a P/L Attribution report that gives a detailed breakdown of your P/L for any time range. The P/L Attribution in Feather Finance always reconciles with the change in Market Value, so you won’t end up in the situation you described where you have unexplained PL.

Hi @Xavier_Robitaille thank you for weighing in. I close all my positions at the end of the day.

I took a look at Feather Finance, and I like it. Thank you for making it available!

The P/L that I get with Feather Finance is the same one I get from the day’s activities (method 1 in my original post). Thus I am inclined to think that there is an error with Alpaca’s .get_account().equity and/or Alpaca’s dashboard.

I will say this again: Does this happen in live trading? I don’t feel comfortable trading real money until fundamental yet straightforward issues like my daily profit/loss are working smoothly.

Maybe @Dan_Whitnable_Alpaca could shed some light here?

Thanks

I don’t know about paper trading, but in my live day-trading (always cash at end of day) the exchange fees are calculated and applied to my account each night (activity type “FEE”). So the equity@open_today = equity@yesterday_close - fees_after_close