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.