1. Preface
I believe that everyone is not unfamiliar with the term "quantitative trading". According to the general view of "quantitative trading" in the industry, quantitative trading is an operation method that uses modern statistics and mathematical theories to trade through computers.
In his spare time, the author analyzes some financial data out of hobbies and participates in financial secondary market investment. Over the years, he has also built his own investment model and made some insignificant gains. This process uses a quantitative mindset.
Quantitative trading products are a very complex system, although mainly used in the financial field, but the transaction categories involved are very large, can be securities, options, futures, insurance, bonds, foreign exchange and other subdivision of the category of quantitative trading alone, can also be these categories into a series of combinations for quantitative trading.
Considering the complexity of quantitative trading products and limited by space, this article mainly focuses on quantitative trading of securities, which does not involve quantitative products such as bonds, options and futures portfolio trading, starting from the basic concepts from shallow to deep, starting from the exploration of quantitative trading products.
2. Product range
In general, whether we buy long or short requires us to conduct fundamental and technical analysis of companies in the secondary market.
To measure whether a company is good or bad, we need to develop an objective evaluation standard. With standards in place, this company information can be "quantified" by computer. Then, by constructing relevant strategies, the computer can decide whether to buy or sell on its own.
The energy of each of us is limited, and it is impossible to complete the analysis of all the trading indicators of all companies on the secondary market in a short time. Market transactions are also limited to a few companies that we are more familiar with, which are relatively limited and often miss a lot of operational opportunities.
Whether it is an individual or an institution, they hope to have a set of solutions that can solve the entire investment cycle, improve the efficiency of market information processing, save labor costs, and obtain stable and sustainable excess returns.
It can be seen that quantitative trading is not to perform a certain operation, but a collection of a series of operations, covering the formulation of indicator parameters, information collection and sorting, data processing and analysis, strategic model construction, business opportunity value discovery and intelligent decision execution, and effect evaluation and optimization throughout the entire investment cycle.
Taking securities as an example, quantitative trading covers the content as shown in Figure 1.
Figure 1 Contents covered by quantitative trading
3. Product features
(1) Strict discipline
When individuals conduct securities transactions, they will formulate a set of operation strategies, when to buy and sell, what securities to trade, and set take profit and stop loss levels. However, in actual trading, individuals are always affected by market sentiment, breaking trading discipline, and eventually making bad decisions due to impulse. The typical performance is to "chase the rise and kill the fall" and forget your "original intention".
Quantitative trading is often carried out in the formulation of its trading strategy, detailed analysis and measurement, and the computer strictly follows the rules, will not be affected by market sentiment. Quantitative trading strictly abides by trading discipline, which can overcome human weaknesses such as greed, fear and fluke in trading and reduce cognitive biases.
(2) Fast and efficient
The world's martial arts are only fast and unbroken. Personal securities trading, it is difficult to quickly operate multiple securities in a short period of time. Even many professional investors, in the case of watching, it is difficult to do dozens or even hundreds of securities rapid analysis, decision-making and operation. Especially for individuals who often trade short-term, opportunities are fleeting, and time is money.
Quantitative trading is operated by a computer and can generally be completed within milliseconds. James Simons is a world-class mathematician and a well-known hedge fund manager. The hedge fund he led achieved short-term operations through quantitative trading and obtained very rich returns.
(3) Comprehensive and comprehensive
Individuals have a relatively simple analysis of securities transaction data, and their computing power is limited. Without the help of tools, it is difficult to analyze data from multiple dimensions comprehensively. At the same time, due to the limited energy of individuals, in the face of the huge data accumulated in securities transactions, it is often impossible to start, and it is difficult to fully mine the value information behind the data, which can only be through personal subjective judgment, and the comprehensive rate of return is low.
Quantitative trading is carried out by computers, theoretically the computing power can be expanded indefinitely, the use of AI (Artificial Intelligence, artificial intelligence) and big data to build a quantitative trading platform, combined with historical data and real-time data, multi-dimensional, multi-level, comprehensive and comprehensive decision-making analysis, greatly improving the comprehensive return on trade.
4. Basic mathematics
The premise of quantitative trading is "quantitative". The basic meaning of quantification is the process of numerical measurement or data explanation, which requires a lot of basic mathematical knowledge.
The famous German mathematician Gauss once said, "Mathematics is the queen of science." Quantitative trading is a scientific system engineering, even basic mathematical concepts, will involve a lot of knowledge points.
Due to space constraints, this article will not go into detail, but only briefly introduce some basic mathematical concepts involved in quantitative trading. For more details of the concept, you can consult professional information if necessary.
(1) Mean
Average can be simply understood as an average. Generally, we use the following averages in quantitative trading.
a). The arithmetic mean, the formula is as follows.
b). Geometric mean, the formula is as follows.
c). Harmonic average, the formula is as follows.
d) Weighted average, the formula is as follows. In the formula, x1f1 is used as an example to indicate that x1 appears f1 times. n is the sum of f1+f2+...+fn.
e). Square mean, the formula is as follows.
(2) Median
Mid-value, also known as median, is the number in the middle of a sequential set of data.
The median is calculated in order from smallest to largest.
If the number is base, take the middle number. For example: 1, 2, 3, 4, 5. The median is 3.
If the number is even, take the average of the two numbers in the middle. For example: 1,2,3,4,5,6, the median is (3+4)÷2=3.5.
(3) Probability
Probability is a quantitative result of the probability of a random event occurring.
For example, we count the events of a coin toss. The coin has two sides, we tossed 10 times, the number of heads up is 5 times, then for this coin toss event, the calculated probability of heads up is 5÷10=0.5.
Based on the nature of probability, many formulas have been derived, such as Bayes' formula.
(4) Derivative
Derivative is an important fundamental concept in calculus. The basic formula is as follows.
In the analysis of securities transactions, derivatives are often used to calculate extreme values (maximum or minimum). The securities market is generally in fluctuation, and the extreme value of the securities in the market is analyzed by derivation, so as to measure the pattern and trend of the K-line.
(5) Normal distribution
Normal distribution, proposed by French mathematician Abraham de Moivre. The curve of the normal distribution is characterized by low at both ends, high in the middle, symmetrical left and right, showing the shape of a bell, also commonly known as the bell curve.
In nature and human production and life, there are many phenomena that appear in the form of normal distribution. For example, the performance of students in school and the level of investor returns in the securities market.
In actual securities trading, the return on stock assets can be calculated with the help of a normal distribution.
For example: stock yield = standard normal distribution signal level× standard deviation of return + mean return
You can also continue to calculate the price of a stock asset from the stock yield.
For example: stock asset price = initial stock price× e [upper corner] stock return, where e = 2.718.
5. Basic indicators
The realization of quantitative trading products is inseparable from the collection and collation of basic information, which is calculated as an indicator and participates in the operation of the entire quantitative trading product.
From both fundamental and technical dimensions, we list some of the more common quantitative trading basic indicators.
(1) Fundamentals
PE (Price Earnings Ratio), the ratio of the price of a stock to earnings per share, PE is divided into static PE and dynamic PE. In value investing, theoretically the smaller the PE, the greater the probability of rising.
PB (Price-to-Book Ratio), the ratio of stock price per share to net assets per share. Generally speaking, assets with lower price-to-book ratios have a higher value of investment.
PS (Price-to-Sales), calculated as [Total Market Capitalization] divided by [Main Business Income] or [Stock Price] divided by [Sales Per Share]. The lower the price-to-sales ratio, the greater the investment value of the company's stock.
PCF (Price Cash Flow Ratio), the ratio of stock price to cash flow per share. The smaller the price-to-present ratio, the greater the company's cash increase per share, which is generally used to evaluate the price level and risk level of the company's stock.
Dividend yield ratio refers to the ratio of the total dividend payout in a year to the current market price. In general, the higher the dividend yield of a security, the more attractive it is to investors.
In addition to the above indicators, there are many financial indicators that reflect fundamentals, such as current ratio, debt asset ratio, operating profit margin, net profit margin on sales, gross profit margin on sales, return on assets, return on net assets, total asset turnover, inventory turnover, etc. These factor data can be obtained from the public financial statements of listed companies.
(2) Technical aspects
Generally speaking, it can reflect the rise and fall of the price of a security, the trend pattern or the combination of candlesticks can be classified as technical indicators. The more commonly used indicators are as follows.
Volume is the number of securities traded over a period of time. The size of the volume indicates the degree to which both long and short sides ultimately identify with the technical pattern of the market at a certain moment.
Amplitude, the absolute value of the difference between the highest and lowest prices and the percentage of the stock price. Amplitude can also be subdivided into daily amplitude, weekly amplitude, monthly amplitude, etc.
Turnover rate, the frequency of stock resale in the market within a certain period of time, is used to reflect whether the stock liquidity is strong or weak. The higher the turnover rate, the more active and popular the trading of the security.
BOLL (Bollinger Bands), by calculating the standard deviation of the stock price, thus obtaining a credible range of the stock price. When the price line is above the middle band of the Bollinger bands, there is a high probability that it is a long market and can be held or continued to buy.
MA (Moving Average) averages the price of securities in a certain period of time through statistical analysis, connecting the average values of different times. MA is mainly used to observe the trend of price changes of securities. MA is divided into 5 days, 10 days, 20 days, 30 days, 60 days, and 120 days.
MACD (Moving Average Convergence/Divergence), which is used to reflect the long and short state of securities and the possible development trend of stock prices.
VWAP (Volume Weighted Average Price), the average price of an asset in a given period is weighted by volume. The basic calculation is: VWAP=(typical price× volume) ÷ total volume. The typical price is calculated as a typical price = (highest + lowest + close) ÷3.
In addition to the above factors, there are many factors, such as turnover, volume, increase, total market capitalization, liquid market capitalization, listing days, RSI (Relative Strength Index, relative strength index), KDJ (K value, D value and J value), TWAP (Time Weighted Average Price) and so on.
6. Basic theory
The basic theory is the guiding ideology for the construction of quantitative trading products. Based on theory, scientifically construct quantitative trading product strategies, combine actual scenarios, verify product solutions, continuously improve arguments and arguments, and continuously optimize products in practical applications.
(1) APT (Arbitragc Pricing Theory)
In 1976, American scholar Stephen Ross published a paper in the Journal of Economic Theory proposing APT. The theory holds that arbitrage is a determinant of the formation of modern efficient markets (i.e., market equilibrium prices). If the market is not in equilibrium, there will be risk-free arbitrage opportunities in the market. APT can be seen as the prototype of multi-factor pricing (stock selection).
Based on ATP, a linear model composed of multiple systemic risk factors, the formula is as follows:
In the formula, E is the expected return, R is the risk-free rate, β is the sensitivity of the portfolio to factor k, and λ is the risk premium in the factor.
(2) CAPM (Capital Asset Pricing Model)
In 1964, American scholars such as William Sharpe, John Lintner, Jack Treynor, and Jan Mosin proposed it to study the relationship between the expected return on assets and risk assets in the securities market.
CAPM formula: Ra=Rf+β*(Rm-Rf)
β represents the beta of a stock, which is the systemic risk of the stock.
RF is the risk-free rate of return and Rm is the average market return. The difference between RM and RF is the stock market premium.
Ra indicates the expected rate of return.
For example:
The β=3 of a stock, the risk-free return rate is Rf=2%, and the market average return Rm=7%, then the stock market premium is 7%-2%=5%.
According to CAPM, the expected return of the stock Ra=2%+3*5%=17%.
We calculate the expected return on a stock as a reference for future stock returns.
(3) Chaos Theory
In 1963, American meteorologist Edward Norton Lorenz proposed chaos theory, which is a method of both qualitative thinking and quantitative analysis to explain and predict a series of overall continuous events in dynamic systems.
The butterfly effect is a very typical case of chaos theory. One butterfly flaps its wings in Brazil and causes more butterflies to vibrate their wings along with it. Thousands of butterflies will eventually wave their wings along with that butterfly, and the hurricane produced by the butterfly could eventually lead to a tornado in Texas a month later.
Chaos theory also applies to capital markets. For example, in 2003, a cow in the United States was suspected of contracting mad cow disease, which first affected the US beef industry and then jobs, involving the US corn and soybean industries, the main feed sources for cattle breeding, and eventually led to a continuous decline in futures prices.
(4) EMH (Efficient Markets Hypothesis)
In 1965, the American economist Eugene Fama published an article entitled "The Behavior of Stock Market Prices" in the Financial Analysts Journal, which first proposed the concept of Efficient Market.
In 1970, Eugene Fama deepened the theory and proposed EMH. EMH assumes that investors participating in the market are rational enough and able to respond quickly and reasonably to all market information.
The core idea of EMH theory is that the company's stock price movement fully reflects the company's current and future value. There are three main forms of EMH:
a) Weak-Form Market Efficiency: Market prices fully reflect all historical security price information. Technical analysis of stock prices is ineffective, and fundamental analysis may help investors make excess profits.
b) Semi-Strong-Form Market Efficiency: Market prices fully reflect all publicly available information about the company's operating prospects. Investors use fundamental analysis in the market to lose their use, and inside information can make excess profits.
c) Strong-Form Market Efficiency: Market prices adequately reflect all information about a company's operations, both publicly available or internally undisclosed. There is no way to help investors make excess profits.
(5) MPT (Modern Portfoilio Theory)
In 1952, the American economist Harry M. Markowit proposed. The core idea of MPT is to minimize the standard deviation (or variance) and maximize the expected return as the goal of asset allocation, and mathematically explain the principle of investment diversification, proving the value of diversified diversification.
Based on MPT, we need to diversify asset allocation, but not simply diversify, but to control the risk within a certain range while maximizing the return on assets. In the process of dispersion, a lot of mathematical tools are required to perform complex calculations.
(6) Trend Theory
Trend theory states that once the market has formed a downward (or upward) trend, it will move in a downward (or up) direction. The premise of the application of trend theory is that it assumes that this trend will continue until it is destroyed by external factors and changes. It is usually used for buying and selling point analysis and market analysis.
Determining trends requires a combination of multiple indicators. Investors draw trend lines through the rise and fall of securities over a period of time, and can visually analyze whether it is an upward trend line, a downward trend line or a sideways trend line.
In the practical application of quantitative trading, trading decisions are made by constructing three trend lines, namely the top line, the holding line, and the bottom line. When the price of a security touches the upper line of the trend channel (escape from the top line), the probability is the time to sell, and when the price of the security reaches the support line of the trend channel (bottom line), the probability is the time to buy.
7. Conclusion
The construction of quantitative trading products is a very complex system engineering, and the preliminary exploration carried out in this paper is only the tip of the iceberg in the entire quantitative trading product system, aiming to throw bricks and lead jade.
For example, the Sharpe Ratio, Delta, Theta, Gamma indicators, Black-Scholes formula, Monte Carlo simulation, etc. are often used in investment transactions.
The securities market is unpredictable, even the trading model is very scientific, the strategy is very accurate, it is inevitable to encounter "black swan" events, and the optimization of quantitative trading products is endless.
A thousand sails passed by the side of the sunken boat, and the sick tree was in front of Wanmu Chun. We need to look at quantitative trading products objectively, can not one-sidedly think that the application of quantitative trading products, investment will never lose in order to obtain excess returns, and we need to maintain a sense of awe for the capital market at all times.
The original intention of quantitative trading products is to transform the manpower-intensive investment activities into knowledge-intensive, improve the work efficiency and investment output of each person, reduce the volatility of investment, and improve comprehensive income.
Investing is a long practice, and the process is full of difficulties and dangers, and you need to constantly review your investment behavior. Quantitative trading products provide a very convenient evaluation tool, through the recording and analysis of transaction data, such as the maximum drawdown, the maximum loss time, to evaluate the investment effect, find shortcomings, and continue to improve.
There are many beings in the world like ants, and lotus hearts only cross the destined people. No matter how advanced quantitative trading products are, they are ultimately only investment tools, and talent is the core of the entire investment trading activity. In this road of financial practice, we find a better self through quantitative trading and become a person with wealth.
Columnist
Wang Jialiang, WeChat public account: Jiajia original. Member of China Computer Society (CCF). Everyone is a product manager columnist, author of the year. Focus on the design concept sharing of Internet products, financial products and artificial intelligence products.