Quantitative Research | Residual Momentum Strategy Characterization and Construction (2)

 

 Committed to sharing quantitative strategies, training videos, Python, programmatic trading and other related content

About the Author

Lu Yangyang 

In-service quantitative strategy researcher of a large asset management company, familiar with data cleaning, good at using macro factors, industry factors, etc. to model the impact of futures prices and correlation analysis, understand machine learning multiple regression methods, SVM, XGboost, financial time The underlying algorithm logic such as sequence, and some algorithms can be encapsulated by custom functions. Master the application of various machine learning packages and data calculation and analysis packages. Including but not limited to: Alphalens, pandas, crawler technology, sklearn, statsmodels, etc.

"text"

ˇ

introduction

In the previous article, we discussed the initial logic and construction process of "residual momentum characterization and construction", and in the second article, we further expanded the construction scope of this logic. As mentioned in the previous article, the idea of ​​this strategy is based on statistical arbitrage across varieties, so we must find varieties with the same industry chain and high cointegration when constructing or determining between varieties. As shown below:

Figure 1 Four major sectors

Logic and Computation

In the oil sector, according to the initial logic, we need to analyze one variety separately from the other two varieties, so there will be 6 situations. "Palm" → soybean oil, "palm" → "vegetable oil", "soybean oil" → "palm", "soybean oil" → "vegetable oil", "vegetable oil" → "soybean oil", "vegetable oil" → "palm".

In this way, not only is it super troublesome to analyze, but it will also lead to 2 times of opening positions when a certain variety quantifies the timing of the same variety in the plate. For example: the initial stage of this wave of rapeseed oil is significantly stronger than palm and soybean oil, then rapeseed oil will open two positions relative to palm and soybean oil. The situation to avoid is to connect the two scenes of "vegetable oil" → "soybean oil" and "vegetable oil" → "palm" to judge the overall logic. This invisibly adds to the combination of strategies, which is what we want to avoid.

The non-ferrous species plate has 6 different varieties, and we need to make 12 permutations and combinations. In order to avoid the above troubles, the author himself has taken the indexing of the plate varieties, namely: oil index, non-ferrous metal index, black index, Chemical index, etc. As shown in Figure 1, we indexed the prices of the main links of each variety in the sector after the restoration of the right. The compiled algorithm is shown in the following figure:

Figure 2 Exponential algorithm

According to the algorithm shown in the above figure, it is actually the calculation of the current K line's opening, high and low closing, according to the ratio of the closing price of the previous K-line, and then averaging according to the number of varieties in the plate, that is to say, the calculation is in the plate. The average of the ratio of opening high and low closing of all varieties, the fitted index data. We use the time series data as the index market data of the sector. In the process of strategy construction, we are more inclined to the benchmark in the stock market, and this is an index market constructed by the same sector and different varieties. In simple terms, we can see it as Average market data for a sector.

Figure 3 Regression calculation of indices and varieties

After we have the above common benchmark, we will perform the regression calculation between the calculated index and the closing price of the variety. The above figure is to calculate the regression residual between a variety and the index, that is, the regression residual of each variety on the benchmark is calculated. For calculation, let's first look at the visualization of each variety and index, as shown in the following figure:

Figure 4 Soybean Oil and Oil Index

The above picture is the K-line chart of the soybean oil and oil index. As shown in the figure, in April this year, during the second bottoming process, soybean oil was more resilient than the overall index, but in the subsequent rebound process, the overall rebound strength of soybean oil. The smoothness and smoothness are not as good as the overall average expectation. Of course, this is from qualitative observation with the naked eye. From the perspective of hindsight, rapeseed oil was the first variety to start a strong trend market, which naturally verifies this judgment.

Figure 5 Index of rapeseed oil and oil

Next, we will use the strategy logic in the previous article and the custom index to calculate the regression residual. The calculation method and logic remain unchanged. If you haven't read the previous article, please click "Residual Momentum Characterization and Construction ( a)" to read.

Figure 6 Index of rapeseed oil and oil       

Figure 6 is a visualization of the indicators after regressing the rapeseed oil and the index, as well as the performance opening and closing position map. From the figure, we can see that the residual of the rapeseed oil relative to the oil index has shown an abnormality on June 15. Through rough timing rules, we time the signal to go long there.

Figure 7 Palm Oil and Oil Index

Figure 7 is a visualization of the indicators after regressing palm oil and the index, as well as the performance opening and closing position map. The rebound of palm oil here is different from that of rapeseed oil, which belongs to the residual normal situation of the stage, including the bull market on May 27, July 17, July 23, and the last crazy September 3 in September.

Epilogue       

To sum up: what we are actually looking for is the strong time of a certain variety relative to the index of the sector, which also indirectly includes the process of selecting varieties, because all varieties are put in, and in the process of selecting time, we also choose to do Long or short varieties.

Strategic Outlook       

The discussion in these two articles is only to provide a strategic idea for the majority of quantitative enthusiasts and practitioners. There are many optimization solutions in the future, which need to be completed by themselves.

Optimization 1: The text is only for the construction of strategies in the oil and fats sector. In the future, it can be expanded to the black sector, the non-ferrous sector, and the chemical sector to build strong strategies.

Optimization 2: There are many effective factors that can be used to judge the strength of the factors, not necessarily just the relationship of residual variance.

Optimization 3: When characterization of residuals timing judgment, due to the unequal structure of long and short, there are differences in the characterization of long and short.

Optimization 4: The entry and exit signals are timed using the turtle trading rule, and other better timing strategies can also be used to further improve the performance and robustness of the model.

Optimization 5: We can construct long-short hedging strategies to capture strategies similar to stock alpha returns.

This strategy is only used for learning and communication, and investors are personally responsible for the profit and loss of real trading.

Guess you like

Origin blog.csdn.net/m0_56236921/article/details/123889165