Dr. Monzer Kahf, Scholar in Islamic Economics and Financial Expert, says,
“In commodity markets most of trades are speculative. For this and other reasons that are equally important, the OIC Fiqh Academy ruled that except for limited kinds of spot trades it is not permissible to invest in the commodity market.
For shares, buying and owning a company share is governed by what the company does and what contracts it practices. Companies whose main line of business is not permissible are not permissible, these include conventional banks and insurance companies, tobacco, liquor, casinos, pork, military, etc.
Out of the remaining companies (whose main line of business is permissible), you need to select those that have least of violation of Sharia in terms of contracts and transactions especially in regard to interest transactions, loans, alcohol, and the like. Also, in terms of dependence on interest-based borrowing and on using assets as interest generating.
In addition to all the above, one has to apply the purification principle by estimating the percentage of non-permissible income out of profit gained and give it away to Muslim charity. Further, please make some study of this issue on the internet.”