Current Stock Holdings that are haram before Learning to Screen

Assalaamu alaikum. I have come to know about the Halal Screening Process for stocks. I was under the impression before that as long as stocks were not involved in the obvious haram that the company would be okay to invest in. Since learning of IFG, I have been through the stock screening process of my current holdings and the majority of the stocks fail on the Debt issue. My question is what do I now? Some of the holdings have profit and some are in loss. I heard a statement that if you were unknown to the stock being haram then it is up to you, whether to donate the gains to charity or keep it. Is this true? Secondly do I need to do anything about historical stocks that have been bought and sold, as I have been trading stocks for about 3years.

JazakAllah khairun

Wasalam

May Allah bless you.
If you are confident that the companies you bought stock in had all shariah compliant businesses, then try to estimate how much income has been received from interest based products.
If you can’t gather the data, then look at current balance sheets and make a guest estimate of how much would that have been.
Then donate that amount into charity, if you can afford in one payment then its good otherwise do it in instalments according to your financial needs.

As for the debt ratio, if they all failed this screening criteria, then its fine, don’t hold such stocks anymore, but don’t worry about giving a specific amount into charity.

And Allah knows best!

Shukran ya Sheikh for the response.

BarakAllahu feek!