Calculate profits for ESPP

Hi,

I buy stocks from my company via a Employee Stock Purchasing Program. This allows me to buy stocks every 6 months at a 15% discount.

Currently I just did the actual purchasing price so (stock price *0.85) to it shows the actual profit I have.

Now since this year we need to pay capital gains tax. The idea was to use PP to calculate my profit so I can look at the buy price, sell price and see the profit.

There are 2 issues:

  1. The 15% discount I get is tax-free.
    So I can set the buy price at the price without the discount to calculate the profit and thus my tax. But then I can’t really track the actual profit I have since it’s 15% more then it’s showing.
  2. The 2nd issue I have is to calculate the capital gains I can use 2 prices.
    Either I use the actual buy price or the price on 01/01/2026 (snapshot). Whichever is the one with the least amount of profit.
    To clarify:
    Scenario 1
    If I bought a stock 01/06/2025 at 100€. On 01/01/2026 the price is 120€ and I sell for 140€. My capital gains is taxed with 140-120= 20€ Profit → on this the tax is calculated
    Scenario 2
    If I bought a stock 01/06/2025 at 100€. On 01/01/2026 the price is 80€ and I sell for 140€. My capital gains is taxed with 140-100= 40€ Profit → on this the tax is calculated.
    And not on the value on 01/01/2026 Since the stock price was lower on 01/01/2026.

Any ideas how I can handle both scenario’s the best?

Worst case is I use a 3th party tool or I write a script to calculate this for me.

There is no straight forward built in Solution for this.
Company shares and discounts are not easy to tackle. Search in the forum, there won’t be any satisfying solution. Even when we all know why this is interesting to know. PP is a pure performance tracker. Discounts and benefits do all interrupt the standard performance KPI’s which is the reason PP handles tax only after they have been paid.