The answer to your question requires an extensive explanation regarding the nature of the stock market itself, the legality of public corporations, and the nature of commodities trading. Much of the explanation is dependent upon your comprehension level of the topic, of the fiqh of transactions, of your usul ul fiqh adoptions. and Allah knows best.