Let’s take a moment to think about what a trading algorithms goal should be. The obvious part is making money i.e, we should try to generate as much positive returns from trading as possible but the stock market is inherently very unpredictable as we have already seen. One approach is to buy stocks that have been showing consistent growth and hold onto them for long periods of time. This usually generates some returns but nothing spectacular unless you happen to pick stocks that grow spectacularly. But, how you tell ahead of time? What if they don’t do as well or even fall? This inherent risk in the market is very real. It is as much part of the game as the actual stock prices. To mitigate this risk, you should maintain a fairly broad portfolio stocks instead of investing a handful. How you choose these stocks can affect how much your returns are affected by market behavior. For instance, you could buy a collection of different technology stocks, so the value of your portfolio will go up. If there’s general growth across the sector, you would be somewhat immune to the chance of individual companies failing badly or you can bind stocks from different sectors to create a more diverse portfolio. It will be less sensitive to any particular sector but is also not likely to go through the roof. This is because in order to generate large returns, all these sectors will need to perform well together. It is much more likely for only some stocks or sectors to perform strongly. Which means the average performance of all the other sectors will reduce any such effect. So, how do you go about picking your basket of stocks? You could perform complex statistical analysis to find collections that are likely to generate good returns but also reduce the overall risk. If you’re just investing your personal money, this might be too much work. Not everyone who wants to invest they have the knowledge and skills to conduct a proper analysis. For this reason, many banks and other financial institutions offer investment funds which are managed by professionals. Mutual funds are one such option which pulling money from multiple investors and then buy shares on their behalf. You can choose funds according to your investment goals. Some are designed to reduce risk, yield a lower expected rate of return while others are configured to give a higher rate of return at increased risk. Some funds track the performance of specific sectors such as infrastructure, technology, communications, et cetera while others may be tied to specific indices. In addition to combining multiple stocks, some funds are traded on stock exchanges themselves. That is, in order to invest money in these funds, you buy their shares on the market. Hence, they are known as Exchange Traded Funds or ETFs. They are very popular investments for stock market investors as it tend to produce some growth as long as the sector or index they’re tracking does well. In addition to mitigating risk, they are also much more economically compared to investing in many stocks individually, because you typically have to pay brokerage and other transaction fees on them separately. A popular ETF is Standard & Poor’s 500 or S&P 500 which trades under the ticker symbol SPY. The S&P 500 include 500 stocks with the large market capitalization that trade on the New York Stock Exchange or Nasdaq, selected from diverse sectors. The composition of an ETF, the stocks and their proportions can vary over time. This gives rise to another source of information that can be useful in making trading decisions. ETF compositional data. For example, let’s say you want to diversify your investment to reduce market risk. You do that by analyzing the individual performance or correlations between stocks. This generates a portfolio that is well-balanced and not too correlated. If you include ETFs like SPY in your portfolio, then there will be some correlation between the ETFs and the individual company stocks that they are made up of. Now, instead of trying to compute these correlations from historic data, wouldn’t it be better if you had access to the exact proportion of stocks used. That’s precisely what an ETF compositional data provides. Using this information, you can obtain a much more accurate measure of how correlated the stocks in a portfolio are and balance them out to further mitigate risks.