Purify capital gains from non compliant stocks

Alsalam Alykom
I hope my message finds you well everyone.

I have a question and I hope, if you have the right answer, to help me.

I invested in sharia compliant companies before I joined IFG, Zoya, Islamicly.
Their businesses seemed Halal for me but later I found out that they have a interest bearing debts and securities.

Non compliant revenue must be donated but my question regarding the interest issue, for example, GEVO stock has 67% interest-bearing securities.

CSIQ stock has Interest-bearing debts 137%.

I stopped investing in these companies and I sold all of my non compliant stocks .

Do I need to purify this return and how do I purify this return/gain from these companies?

I hope you have previous examples, links, fatwa, or an answer.

Thank you everyone.

Wasalam

May Allah bless you.
If they had interest bearing debt above the acceptable level, then they are some scholars who would advice to purify any gains made during that period.
However, I do not feel this is necessary as, even thought the share was not compliant for breaching the debt level ratio, the profit made during that time was not from a haram source per se. So there should be no need to purify something which you have not received in the first place.

Of course, if you decide to purify all your gains made during that time, then it would be a much safer approach.

Do what your heart feels comfortable with.

And Allah knows best!

May Allah bless you too.

I will do my best inshallah.

Thank you.