Taking losses into account when purifying

اَلسَّلاَ مُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَا تُهُ

When a stock turns non compliant, we are told all the profit must be given into charity.

As a short term trader, Can we take into account losses that we have made when trading that stock before or after the stock Turned non complaint.

For example, I am trading a stock whilst it was shariah complaint and I made losses of £10 and then I brought the stock again.whilst holding, the stock turns non complaint and sold it straight away and made profit of £20. This was during The same month. Do I have to give the £20 in charity or can I take into account the loss and give only £10 in charity.

If you can take losses into account, what interval can we take losses into account e.g Daily weekly monthly Yearly.

جزاك اللهُ خيرًا

2 posts were merged into an existing topic: Investing Question: What to do when shares stop being sharia compliant