We construct a stock portfolio based on the assumption that stocks will revert to a given index represented by an ETF. In the example here, we use the entire stock market and VTI, the total stock market ETF. Slopes of zsore prices are the measure of deviation from VTI as well as the basis for computing weights.

We construct the portfolio as follows:

  1. Cluster stocks using 126 days of data, transformed into fractional return series, with Dynamic Time Warping and the K-Medoids algorithm (See K-Medoids Clusters With Dynamic Time Warping Distances Have Been Added To Daily Asset Analysis).
  2. Using stocks only, select those with volume >= 100,000 shares.
  3. For 126 days, transform all prices to zscores and compute slopes (See Standard Deviation And Slopes Have Been Added To Daily Asset Analysis).
  4. Divide stocks into two groups: those with slopes greater and lesser than VTI slope. Randomly choose 5 from each such that each stock is in a unique K-Medoids cluster.
  5. Compute two types of weights. Aggressive weights are proportional to |stock slope – VTI slope|, while conservative weights are proportional to 1/|stock slope – VTI slope|.
  6. For stocks whose slopes are greater than VTI slope, weights are negative. For stocks whose slopes are less than VTI slope, weights are positive. Thus mean reversion.
  7. Select and quantify a directional bias. Neutral means 1/2 of the portfolio is long and 1/2 short. Long means 2/3 long and 1/3 short. Short means 1/3 long and 2/3 short. This information is used to normalize the weights.

1/2 Long 1/2 Short

NameTrade DirectionSlopeDelta Slope1/Delta SlopeCluster NumberAggressive WeightsConservative Weights
TWSTTwist BioscienceLong0.00450.018952.9101640.18490.0194
RRCRange ResourcesLong0.02240.0011000.040.00980.366
NCMINational CineMediaLong0.0090.014469.4444860.14090.0254
ATAIatai Life SciencesLong0.01370.0097103.0928200.09490.0377
NSITInsight EnterprisesLong0.01630.0071140.8451100.06950.0515
SHAKShake ShackShort0.02450.0011909.090977-0.0705-0.1178
DFHDream Finders HomesShort0.0260.0026384.615460-0.1667-0.0498
LIILennox InternationalShort0.02440.0011000.018-0.0641-0.1296
HUBBHubbellShort0.02430.00091111.111147-0.0577-0.144
FORForestar GroupShort0.02560.0022454.545531-0.141-0.0589

1/3 Long 2/3 Short

NameTrade DirectionSlopeDelta Slope1/Delta SlopeCluster NumberAggressive WeightsConservative Weights
TWSTTwist BioscienceLong0.00450.018952.9101640.12330.0129
RRCRange ResourcesLong0.02240.0011000.040.00650.244
NCMINational CineMediaLong0.0090.014469.4444860.09390.0169
ATAIatai Life SciencesLong0.01370.0097103.0928200.06330.0252
NSITInsight EnterprisesLong0.01630.0071140.8451100.04630.0344
SHAKShake ShackShort0.02450.0011909.090977-0.094-0.157
DFHDream Finders HomesShort0.0260.0026384.615460-0.2222-0.0664
LIILennox InternationalShort0.02440.0011000.018-0.0855-0.1727
HUBBHubbellShort0.02430.00091111.111147-0.0769-0.1919
FORForestar GroupShort0.02560.0022454.545531-0.188-0.0785

2/3 Long 1/3 Short

NameTrade DirectionSlopeDelta Slope1/Delta SlopeCluster NumberAggressive WeightsConservative Weights
TWSTTwist BioscienceLong0.00450.018952.9101640.24660.0258
RRCRange ResourcesLong0.02240.0011000.040.0130.4879
NCMINational CineMediaLong0.0090.014469.4444860.18790.0339
ATAIatai Life SciencesLong0.01370.0097103.0928200.12650.0503
NSITInsight EnterprisesLong0.01630.0071140.8451100.09260.0687
SHAKShake ShackShort0.02450.0011909.090977-0.047-0.0785
DFHDream Finders HomesShort0.0260.0026384.615460-0.1111-0.0332
LIILennox InternationalShort0.02440.0011000.018-0.0427-0.0864
HUBBHubbellShort0.02430.00091111.111147-0.0385-0.096
FORForestar GroupShort0.02560.0022454.545531-0.094-0.0393

We note that all of the data was directly taken from data that we compute each market day (available at our Proton Drive). Specifically, data was from:

  • Dynamic Time Warping Nearest Neighbors And K-Medoids Clusters 2023-08-04.zip: Dynamic Time Warping Nearest Neighbors Fractional Return 126 Days Stocks.csv
  • Analysis 2023-08-04.zip: Slope Zscore Arrays.csv

We could have performed a fresh clustering at the end of step 4 above for each of the two divisions of stocks, but we wanted to highlight a use case for the data that we compute each market day.

If you find such information useful, we ask that you provide value in return via the Value 4 Value links on theĀ homepage. We would also appreciate you spreading the word about our work.