R Tutorial : Why do people trade?

A trade is exchanging cash for an asset. People trade to profit from price moves, hedge risk (like airlines locking in oil prices), or adjust their exposure. Two main styles: divergence traders bet prices keep moving the same way, while convergence traders like Warren Buffett bet prices revert after dropping.
Chapters
Before introducing quantstrap, let's establish the reasons people trade and what a trade is. First and foremost, a trade is simply the act of buying or selling an asset, whether that's a financial security, such as a stock, that is ownership of a company's equity, a bond, that is ownership of a company's or government's debt, or a tangible physical product such as commodities like gold or oil, metals and corn. This is done through converting cash, such as dollars, into ownership of this product and either converting the product, such as shares in a company's stock, back into cash, hopefully for a profit, or actually taking delivery of a physical good, such as an oil company. Taking a shipment of crude oil for refinement while making a profit from acting on trading opportunities is one reason for trading, there are others. Certain companies whose business revolves around commodities enter the financial markets to protect themselves from the business impact of price movements of an underlying commodity. For example, Hershey's might want to establish a good price for chocolate, airlines want to minimize the impact the price movement of oil has on their business, and so on. For instance, if the price of oil rises too much and an airline doesn't protect itself against that, it would either have to raise ticket prices while its competitors don't, or make a lot less profit. Large financial institutions may want to increase or decrease their exposure to various sources of returns and the riskiness that comes with them. At the heart of the matter is that financial instruments bear risk and a payoff for bearing that risk. The aim of a systematic trading strategy is to make an educated guess as to when the ratio of reward to risk is favorable enough to bear the risk and in turn gain compensation while not bearing that risk when the compensation is insufficient. In terms of the mechanics of trading, there are essentially two types of trades. Divergence, also called momentum or trend trading, is the belief that a quantity will continue to increase or decrease if it has already been increasing or decreasing respectively. A class of hedge funds known as commodity trading advisors or CTAs have made a lot of money on proper trend following trading techniques. These classes of strategies are characterized by suffering small losses in trendless markets while making a great deal of money when a trend is establishes. The opposite style of trading is convergence, mean reversion, oscillation, or contrarian style trading. This type of trading philosophy is one that attempts to predict when a certain quantity will reverse direction. For instance, the famed Warren Buffet value investing philosophy is one that buys companies after their price has suffered a considerable amount of depreciation in the hopes that this price depreciation has mostly run its course and will reverse in the near future. Contrarian trading styles are classified by many small gains while suffering the occasional larger loss when entering a depreciating position too early. Let's move on to some exercises.
More from Richie

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon







