Investment strategy evaluationLong-short position percentage (lspr) in the application of quantitative investing of digital assets
In order to allow users to understand more marketplace information, numerous exchanges launched contract large data products, including long-short position percentage, open up interest, contract basis and other data closely linked to the contract marketplace. These marketplace data are marketplace portraits drawn by countless info traders and sound traders with the expense of real money. The data includes a lot of useful information. Analyzing marketplace data helps traders judge where the current market will be and predict the near future marketplace trend, in order to better control risks and seize opportunities.
This article mainly conducts a quantitative analysis from the Long Short Position Ratio (Long Short Position Ratio, hereinafter known as lspr) in OKEx contract big data products. Let's consider Bitcoin for example to review the partnership between lspr and marketplace trends in the past six months, and make use of modeling and other methods to try to understand the predictions of lspr. Section 1 Long-Short Placement Ratio Launch The long-short place percentage is calculated because the number of accounts holding net longer placements divided by the number of accounts holding net short positions:
The so-called online position refers to the number and path of the rest of the contracts in case a trader holds both short and longer contracts of a certain digital asset for a few purpose, after offsetting the longer and short contracts he holds one to one. In the contract market place, every time a trader opens a long order, you will see a corresponding clear order. That's, at any time on the market, the number of lengthy and short orders may be the same. The merchandise of the average number of lengthy contracts held by the net lengthy account and the net lengthy account may be the final number of lengthy contracts. Exactly the same holds true for short contracts. From the above two points, the following formula can be acquired:
From (1)(2), we are able to get:
It can be discovered that lspr can be converted into the percentage of the average open attention of short accounts to the average open attention of long accounts. This means: the higher the lspr, the larger the average quantity of shorts; and vice versa. For example, if lspr will be 3 at the moment, it means that normally, the margin used by each internet short position will be three times the margin used by the net longer position. In most cases, we believe that info traders have benefits in funds and news, and may obtain excess comes back on the market. When traders with small funds are purchasing greedily or selling fearfully, the information traders hiding in the shadows may present their feet for the lspr factor. Extended reading: Investment perspectives | How exactly to observe Bitcoin trends with spot and derivatives market data? Chapter 2 Element Derivation Element derivation, the scientific name "feature engineering", is a process of executing some transformations on the basis of the original data so the algorithm can better obtain info from the info. The data found in this informative article may be the lspr worth of the BTCUSD delivery contract for the OKEx platform as well as the BTC/USD place price for the Bitfinex platform. The time span will be from August 1, 2019 to June 9, 2020. The training set will be from August 1, 2019 to Feb 1, 2020. Just data in this range will be used for evaluation and modeling. The info from Feb 1, 2020 to June 9, 2020 is a validation set, that is intended to verify whether the law is steady. Section 1 Launch to Derivative Aspects In order to fully remove the information contained in lspr, while considering the limitations of observable samples, we have designed two period dimensions and three statistical measurements, totaling six elements: Table 2.1 Derivative factors (1) lspr moving average By calculating the moving typical of lspr, the impact of extreme ideals ??can be eliminated to a certain degree, and a far more steady lspr value can be acquired. Among them, f_ma_ld may be the typical lspr of the past 72 hrs, and f_ma_sd may be the typical of the past a day. Both reveal the absolute level of lspr in the recent period. The following will explore whether the performance of the prospective changes in the future when the lspr reaches different levels. (2) Change price of lspr The pace of change in lspr measures recent changes in lspr. When lspr lowers, this indicator becomes harmful, and vice versa. Among them, f_roc_ld may be the price of change of the existing lspr worth compared to the worth of 72 hrs back, and f_roc_sd may be the price of change of the existing lspr worth compared to the worth of a day ago. Once the worth of lspr starts to rise, it might mean that traders with smaller funds are starting to perform more, or that traders with benefits in funds and information begin to increase positions and bet that the near future will fall, then the price of change of lspr can intuitively describe this sensation , To provide traders with signals to change the market. (3) lspr volatility Compared with the above two reasons, the calculation of lspr volatility could be slightly more difficult. Subjectively, if the lspr volatility price is low, it means the long and short positions have dropped into a condition of anxiety during this time period of your time, and the two sides come in a difficult place; on the contrary, if the lspr volatility price is high, it means that at the amount of the capital game, the amount of funds Smaller traders' funds are jumping backwards and forwards on both sides of longer and short. This example can be described as "restlessness." What kind of marketplace situation "restlessness" and "stress" match in the future requires quantitative evaluation. Below, we calculate the coefficient of variation (Coefficient of Variant) for lspr in the past 72 hrs and a day, as an estimation of its volatility. Extended reading: Five-Minute SchoolWhat is "Volatility"? How exactly to apply in digital asset strategy Section 2 The performance from the derivative elements is dependant on empirical considerations, as well as the forecast focus on selection may be the next 72 hrs, that's, the return price within the next three days. Through the exercising set time period, the BTC's rise and fall within the next 72 hrs is shown in the body below, which generally covers the marketplace fluctuations and tendencies. Body 2.1 BTC's future 72h return price sequence In most cases, after processing each factor, it is first necessary to make an instant and preliminary assessment from the predictive ability from the derivative factors. In this study, the different factors are sorted from little to large, as well as the segmentation threshold is determined by the CART choice tree algorithm, as well as the example is split into a number of intervals. Then calculate the average worth of the elements in each interval and the average worth of the matching rate of return, in order to intuitively judge the influence of each aspect on the price of return. The CART choice tree algorithm, in most cases, can be an algorithm that uses a binary tree to classify or regress data. as the picture shows: Body 2.2 The CART decision tree diagram classifies people A, B, C, , L. The glowing blue nodes are called split points, as well as the orange nodes are called leaves. The number of leaves also determines that decision tree lastly divides the samples into several classes. In the algorithm of the paper, considering that the number of samples is not very large, the maximum number of leaves can be arranged to 5, that's, the sample will be split into 5 at most, and a single leaf contains the least sample size of 16% of the full total. After calculating all of the factors as well as the rate of return, a sample is taken at zero each day and put into the training set. A total of 174 samples are obtained. (1) lspr moving average The average value of lspr in the past 24 hours has a significant negative impact on the near future 72-hour yield. The larger the observed worth of f_ma_sd, the more likely it will fall within the next 72 hrs, and vice versa. This is consistent with the prior hypothesis and contains a strong reasonable interpretation. As shown in the body below, the example is split into 5 parts in ascending order of factor size for grouping stats. Among them, in team 0, the average factor is approximately 1, as well as the matching average return will be slightly higher than 0; as the average factor in team 4 is more than 1.5, the corresponding average return is significantly less than -2%. And the average return price of the team with a lower average score had been significantly higher than that of the team with an increased score. Body 2.3 The grouping result of f_ma_sd The average worth of lspr in the past 72 hrs also shows similar properties in the training set, therefore i won't do it again it here. Body 2.4 f_ma_ld grouping results (2) lspr change rate In the training set, by observing the grouping outcomes of f_roc, we are able to find that a sharp decrease in f_roc does mean that it is more likely to rise within the next 72 hours, while a sharp rise in f_roc is not a good sign for the bulls. If the existing lspr increases sharply from 3 days back, the bulls are at a drawback. If the existing lspr falls sharply in comparison to 3 days ago, the anticipated return of heading long could be higher. However, when the price of change will be near zero, the predictive ability of this aspect for future comes back is almost vulnerable. See the picture below for information: Body 2.5 f_roc_sd grouping results Body 2.6 f_roc_ld grouping results (3) lspr volatility We are now able to response the queries raised in the previous section. At the financial degree, the "stress" of both long as well as the short is more likely to indicate a future decline, as the "rest" of lspr is truly a harbinger of a fresh round of marketplace conditions. Body 2.7 f_rv_sd grouping results Body 2.8 f_rv_ld grouping results Section 3 Model developing In the last chapter, we have summarized some rules. However, there may be interactions between various elements, and there may also be some nonlinear associations. In order to remove more valuable info for investment guidance from lspr, it's important to further set up a quantitative model. Section 1 Algorithm improvement The elements constructed in this article all show a certain connection with the near future price of return in the known data, and can be logically explained logically, so all of the above 6 factors can be put into the model. In practice, although the prediction of a single algorithm has specific guiding significance for future market trends, it is extremely vague. According to the theory of machine studying, we use multiple algorithms to enhance training to attain the reason for integrating the training capabilities of multiple algorithms and getting better prediction results. With regards to modeling ideas, you can first make use of six elements and their matching dependent variables, and make use of linear and nonlinear models for in-sample exercising to obtain multiple weak classifiers; after that use the installed worth of the vulnerable classifier result as Factors are incorporated with linear models to get the final model, that is found in the check set. The reason behind integration would be to reduce the chance for a single model being unreliable, and to enhance the stability of the model as well as the generalization ability on unknown data. Among them, the linear choices are OLS and RidgeCV. The former may be the simplest and may be intuitively understood and explained by observing the regression equation, but it may be affected by aspect multicollinearity when examining the effect of elements. The latter introduces a regular term to reduce the influence of multicollinearity. Although cross-validation decreases the possibility of presenting posterior knowledge, in addition, it increases the complexity of the model. Since the correspondence between certain factors as well as the price of return is not linear, we also decided to use nonlinear model decision trees and random forest algorithms. Your choice tree algorithm can remove easy-to-understand rules, and would work for data models with high function dimensions and little sample dimensions. We give the minimal sample size of a single leaf to hyperlink over-fitting. But its result predictions are focused on several blades, so you can clearly note that its result predictions are "crowded collectively." The arbitrary forest algorithm utilizes the bagging method to randomly select elements and samples to teach a large number of unbiased decision trees and shrubs, and utilizes the voting method of each choice tree to get the final model. It can extract the information of training samples very well, but at the trouble of explanatory power, it could be regarded as a dark box to a certain degree. Body 3.1 Design performance The aforementioned figure displays the performance of each model on the training arranged and test arranged. Among them, OLS, Ridge_Resume, DecisionTree, RandomForest are four sub-models respectively. The first row displays the performance from the model in the training arranged. In each scatter storyline, the horizontal and vertical axes are the predicted worth of the sub-model and the actual BTC's actual price increase and decrease in the next three days. Below each scatter storyline, the goodness of fit R^2 from the model is listed. The bigger the worthiness, the stronger the predictive ability of the model. Although this worth is generally not large, it is currently extremely Practical significance. The second collection may be the validation arranged. This line displays the generalization ability of models using different algorithms on unknown data. It's very reasonable the prediction effect will be attenuated compared to the exercising arranged, but R^2 exceeding 0.05 indicates that every sub-model also has a certain predictive effect. The fifth column, ALL_OLS, shows the performance from the integrated super model tiffany livingston built utilizing the OLS algorithm with the predicted values ??of all sub-models as factors. Although its R^2 performance is not the very best on the check set, it is chosen because the final model since it avoids the contingency of model selection and decreases the impact from the failure of a single model overall. In the 3rd row, the decision tree can be used to optimally group the output value and actual value of the ALL_OLS super model tiffany livingston in the training set to obtain its cut point. Then team the cutpoints acquired in the previous step from the predictions made by ALL_OLS in the validation arranged. The bar chart (best) may be the mean of each group of predicted ideals ??in the validation arranged, as well as the bar chart (bottom level) may be the mean from the matching true values. Based on this, it could be seen intuitively the model does have certain predictive features. However, because of the complexity from the algorithm as well as the restriction of the amount of data, the economic logic behind the model remains to be further explored in the future. Section 2 Discretization of prediction results From the pursuit of model stability, the following two-step technique is adopted. The first step is to use the integrated model method mentioned in the previous section, which decreases the influence of a single model failure overall as well as the contingency and subjectivity of model selection. The second step would be to discretize the prediction results. Discretization can reduce the possibility of overfitting and enhance the generalization ability of the model, so the model can be used more confidently on unknown data. The general process of discretization of forecast results is as follows: First, in the training set, the fitting worth of the ALL_OLS super model tiffany livingston output is obtained for the true fluctuation, as well as the fitting worth is divided through the decision tree to get the optimal grouping, and then a mapping table is obtained: Body 3.2 Discretization mapping table Once the validation place data is input in to the trained ALL_OLS super model tiffany livingston, it will result a predicted value, that may then be converted into discrete ideals ??through the mapping table. If the predicted value will be 0.01, then it will be changed into 2 based on the above mapping table. When the predicted value will be 0.05, then your converted value will be 4. In this study, the left-open and right-closed method was used, but transforming this setting will not have a decisive impact on the strategy. Section 4 The model application model is dependant on the BTC contract long-short place ratio data. For that reason, the main procedure target of the strategy is also BTC. According to the grouping of model prediction results, we constructed the following strategy. The model predicts the trend of BTC within the next 72 hrs, but it generates a prediction end result every day, which really is a rating of 0 to 4. The range of place will be [-1,1], that's, short full place to long complete place. Take the average of the credit scoring results of the past three days and use it as today's place indicator to guide positions. For example, if the scoring outcomes of the past three days are 2, 3, 3, the average score from the three days is 2.67 points. The positioning of 2.67 in the interval [0, 4] is mapped towards the interval [-1, 1], Obtained that the existing position ratio ought to be 0.335, that's, use 33.5% of funds to visit long. Section 1 Technique Construction Based on this idea, three strategies can be constructed: Five-tier strategy: That's, the position percentage of -1, -0.5, 0, 0.5, 1 corresponds towards the rating of 0, 1, 2, 3, 4. This structure method is relatively neutral and will not add a priori subjective view of the marketplace , And the placements are relatively continuous, and the cost of repositioning is little; Five-layer pure lengthy strategy: that's, the position percentage of 0.2, 0.4, 0.6, 0.8, 1 corresponds towards the credit scoring of 0, 1, 2, 3, 4. This structure method includes a priori subjective view and believes that Bitcoin ought to be long-term Hold, so it's more suitable for the "coin hoarding party" (significance investors who hold digital assets for a long period) for short-term hedging of risks; Two-tier strategy: that's, utilizing the position percentage of -1, 0, 0, 0, 1 corresponds towards the credit scoring of 0, 1, 2, 3, 4, take notice of the grouping results in Chapter 3, you'll find the predicted grouping is in the extreme team ( The prediction effect of the first team and the 5th group) is relatively robust, as the prediction effect in the middle group (the next, third, and 4th group) is relatively fuzzy. For that reason, it could be considered to move short only once the market falls into the very first group, and move lengthy when it falls into the 5th group. Section 2 Technique Backtest The performance of the three strategies through the check period (Feb 1, 2020 to June 9, 2020) is shown in the figure: Body 4.1 Technique backtesting funds curve calculation commonly used strategy evaluation indicators, you may get: Table 4.1 Technique Evaluation Catalog Each strategy has achieved excess returns in accordance with online holdings of BTC. The Sharpe percentage from the two-tier strategy may be the highest. Using a risk-free price of return of 3%, Sharpe gets to 2.22. But by observing its collateral curve, it could be discovered that in most of that time period, the strategy is short because of the harsh opening conditions from the strategy. Too few open up positions mean that the evaluation from the strategy from the backtest results may very well be insufficient, and in a longer time of time, it could conflict with the observation outcomes of this backtest. For that reason, we do not believe this is a good strategy. . Weighed against the five-layer purely prolonged strategy, the five-tier strategy allows the short-selling strategy to accomplish significantly greater results. It is because through the backtest time period, BTC basically out of zero profit. Nevertheless, as a "coin hoarding party" or perhaps a loyal believer of BTC, this strategy can also hedge some short-term downside risks of BTC on their behalf. The best performing from the three strategies may be the five-tier long-short strategy. Through the backtest amount of about three weeks, nearly 30% of gains were acquired, the Sharpe percentage achieved 2.17, the maximum drawdown was only 10%, and the maximum holding percentage was 100%, that's, without any leverage, so there is no Theoretical threat of liquidation. This plan is also in line with a few of our thinking in investment activities: don't think the story, but have confidence in the fluctuations of the marketplace. Chapter 5 Overview In summary, in the large contract data of OKEx Swap, the sign lspr can play an improved guiding role in the future BTC marketplace. Intuitively, the average worth of lspr in the past three days will be adversely correlated with BTC comes back within the next 72 hrs, and big fluctuations in lspr usually indicate a high probability of rise. Making use of lspr data, we constructed a simple strategy. Through the time period from Feb to June 2020, the strategy achieved a 27% extra return in accordance with BTC, as well as the Sharpe percentage had been 2.17, which was an excellent performance. Limited by the amount of lspr data, the strategy check constructed in this article requires a short time, and there may be unstable performance in potential investments with more time duration. But in any case, lspr data can certainly extract market info from a exclusive perspective. Further analysis can blend multi-frequency and multi-variety lspr data with other effective factors to make more accurate estimates from the long-term and short-term tendencies of digital assets in the future market.















