The exercises presented throughout this book are related to historical financial data and require the reader to have some basic understanding of financial markets and reports.
Fundamental analysis is a set of techniques to evaluate a security—stock, bond, currency, or commodity—that entails attempting to measure its intrinsic value by examination related to both macro and micro, financial and economy reports. Fundamental analysis is usually applied to estimate the optimal price of a stock using a variety of financial ratios.
Numerous financial metrics are used throughout this book. Here are the definitions of the most commonly used metrics [A:16]:
Technical analysis is a methodology used to forecast the direction of the price of any given security through the study of past market information derived from price and volume. In simpler terms, it is the study of price activity and price patterns in order to identify trade opportunities [A:17]. The price of a stock, commodity, bond, or financial future reflects all the information publicly known about that asset as processed by the market participants.
The purpose is to create a set variable x, derived from price and volume; x = f (price, volume) then generate predicates, x op c, where op is a Boolean operator, such as > or =. The op operator compares the value of x to a predetermined threshold c.
Let's consider one of the most common technical indicators derived from price: the relative strength index RSI, or the normalized RSI; nRSI, whose formulation is provided here for reference:
A trading signal is a predicate using a technical indicator nRSI(t) < 0.2. In trading terminology, a signal is emitted for any time period, t, for which the predicate is true. Have a look at the following graph:
Traders do not usually rely on a single trading signal to make a rational decision.
As an example, if G is the price of gold, I10 is the current rate of the 10-year Treasury bond, and RSIsp500 is the relative strength index of the S&P 500 index, then we can conclude that the increase in the exchange rate of the US$ to the Japanese Yen maximizes for the trading strategy: {G < $1170 and I10 > 3.9% and RSIsp500 > 0.6 and RSIsp500 < 0.8}.
An option is a contract that gives the buyer the right but not the obligation to buy or sell a security at a specific price on or before a certain date [A:19].
The two types of options are calls and puts:
Let's consider a call option contract on 100 shares at a strike price of $ 23 for a total cost of $ 270 ($ 2.7 per option). The maximum loss the holder of the call can incur is the loss of premium or $270 when the option expires. However, the profit can be potentially almost unlimited. If the price of the security reaches $ 36 when the call option expires, the owner will have a profit of ($ 36 - $ 23)*100 - $ 270 = $ 1030. The return on investment is 1030/270 = 380 percent. Buying and then selling the stock would have generated a return on investment of 36/24 - 1= 50 percent. This example is simple and does not take into account transaction fee or margin cost [A:20]. Have a look at the following graph:
.
There are numerous sources of financial data available to experiment with machine learning and validation models [A:21].