Calculating a user's daily profits / losses using their previous balance and their current balance (let's say for things like financial portfolios) is pretty trivial.

The part I find difficult is how we do calculate profits and losses using a user's account balance when they make a new deposit or withdrawal.

For example:

  • User A (yesterday) had: $100
  • User A (today) has: $110

That's a 10% profit.

What if User A also made a deposit of $100 today so now it's:

  • User A (yesterday) had: $100
  • User A (today) has: $210

Technically it's still a 10% profit and not a 110%, so how do we take into account deposits and withdrawals?

Also is there a name for this type of problem in financial applications?

  • 1
    What (or where) is the distinction between a profit and a deposit? How is a profit added to the account, if it is distinct from a deposit? – Steve Nov 30 '19 at 12:10
  • Do you have a log of deposits and withdrawals? – Theraot Nov 30 '19 at 12:20
  • so the difference would be "a profit is any amount above a user's balance that was not from a deposit" and yes we have a log of all deposits and withdrawals – Free Lancer Nov 30 '19 at 15:19
  • I'm not clear what other kind of transaction will increase the balance of the account, besides a deposit? If you earn interest, isn't have a kind of deposit? I don't have much of a backing in finance, so this might be my own misunderstanding. – Greg Burghardt Dec 4 '19 at 13:58

In order to answer your question, you need to model more precisely your domain:

  • If you just compare the daily balance of the account, you will find a 110% increase. But that's not a profit, it's a variation.
  • If you do not have precise definitions, you might also consider that the profit is only 5% at the end of the second day, since the use made $200 deposits in total and the only profit made with this money in the two days is $10.

To make meaningful financial analysis, you need to know the movements that happened on your account and justify the changes in the account balance:

  • profit: additional money earned, that the customer didn't own before
  • loss: money lost, that the customer does no longer owns
  • transfers, such as deposits and withdrawals, i.e. money that was and is still owned by the customer but may or may no longer be on the account.

The profit and loss analysis makes only sense for a well defined period:

  • If you have a profit of $10 on first day of the month, and an additional profit of $20 on the last day of the month, your profit for the month is $30.
  • If you're analysing the daily profits and loss, the daily profit of the last day of the month is only $20, because the $10 earned on the first day of the month are already owned by the customer on the second day.

Note also that profit and loss are understood as the net result of one or several transactions. In reality it is the result of the revenue minus the expenditures. So if your interest is $10, but the bank charges a fee of $1, $10 would be the income, $1 the expenditures and $9 the profit.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.