We present a combination of the ideas from Quant And Machine Learning Portfolio Construction: Mimicking An Asset Price Series With Nearest Neighbors and Quant And Machine Learning Portfolio Construction: Mimicking An Asset Price Series With Nearest Neighbors – Part 2 to construct a portfolio and compute weights to mimic a given time series.

We begin by choosing the SPDR Bloomberg 1-3 Month T-Bill ETF (BIL) to mimic with a stock portfolio. With 150 formation days, we consider stocks with average volume >= 100000 shares. Data is transformed by conversion into a fractional return series, then applying the piecewise aggregate approximation (PAA) with 30 pieces each of length 5 days.

Then we apply the nearest neighbors algorithm using the dynamic time warping (DTW) distance to select 30 stocks that comprise our portfolio.

Using the same DTW distance, we apply the separable natural evolution strategy (SNES) from EvoTorch to find weights, both long only and long/short, that minimize the distance from the portfolio to BIL. This entails selecting weights, simulating the resulting portfolio for 150 days, rebalancing at the end of each quarter, which generates a time series. This time series is then transformed as stated above and the resulting DTW distance to that of BIL is the fitness value that SNES seeks to minimize.


EMLDFTAC Emerald Acquisition Corp.0.00110.0423
ZINGFTAC Zeus Acquisition Corp.0.00150.0312
JGGCJaguar Global Growth I0.00160.0191
SCRMScreaming Eagle Acquisition Corp.0.00170.0191
CVIIChurchill Capital Corp VII0.00170.0405
XPDBPower & Digital Infrastructure Acquisition II Corp0.00170.0301
ASCBA SPAC II Acquisition Corp.0.00180.0464
NFNTInfinite Acquisition Corp.0.00190.0191
APGBApollo Strategic Growth Capital II0.0020.0191
BIOSBioPlus Acquisition Corp.0.0020.0572
AACAres Acquisition Corp.0.0020.0191
FSNBFusion Acquisition Corp. II0.00220.0191
CPAAConyers Park III Acquisition Corp.0.00220.0191
CCVIChurchill Capital Corp VI0.00220.0569
GFGDGrowth for Good Acquisition0.00220.0393
BFACBattery Future Acquisition Corp.0.00220.0191
TCOAZalatoris Acquisition Corp.0.00220.0572
RRACRigel Resource Acquisition Corp.0.00230.0572
PLAOPatria Latin American Opportunity Acquisition Corp0.00230.0191
SLAMSlam Corp.0.00240.0191
CNDAConcord Acquisition Corp II0.00260.0572
IVCAInvestcorp India Acquisition Corp.0.00270.0242
LCAAL Catterton Asia Acquisition0.00270.0191
WNNRAndretti Acquisition Corp.0.00280.0191
KNSWKnightSwan Acquisition0.00280.0191
XFINExcelFin Acquisition Corp.0.00280.0572
MITAColiseum Acquisition0.00290.0446
CCVChurchill Capital Corp V0.0030.039
TRTLTortoiseEcofin Acquisition III0.00310.0191
THCPThunder Bridge Capital Partners IV0.00340.0522


Long and Short

EMLDFTAC Emerald Acquisition Corp.0.0011-0.1365
ZINGFTAC Zeus Acquisition Corp.0.00150.002
JGGCJaguar Global Growth I0.0016-0.0
SCRMScreaming Eagle Acquisition Corp.0.0017-0.0191
CVIIChurchill Capital Corp VII0.00170.0445
XPDBPower & Digital Infrastructure Acquisition II Corp0.00170.0
ASCBA SPAC II Acquisition Corp.0.0018-0.0
NFNTInfinite Acquisition Corp.0.0019-0.0026
APGBApollo Strategic Growth Capital II0.0020.0511
BIOSBioPlus Acquisition Corp.0.002-0.0
AACAres Acquisition Corp.0.0020.005
FSNBFusion Acquisition Corp. II0.00220.0931
CPAAConyers Park III Acquisition Corp.0.00220.025
CCVIChurchill Capital Corp VI0.0022-0.0533
GFGDGrowth for Good Acquisition0.0022-0.0
BFACBattery Future Acquisition Corp.0.00220.0743
TCOAZalatoris Acquisition Corp.0.0022-0.0
RRACRigel Resource Acquisition Corp.0.00230.043
PLAOPatria Latin American Opportunity Acquisition Corp0.00230.0789
SLAMSlam Corp.0.0024-0.0223
CNDAConcord Acquisition Corp II0.00260.0
IVCAInvestcorp India Acquisition Corp.0.0027-0.0312
LCAAL Catterton Asia Acquisition0.00270.0
WNNRAndretti Acquisition Corp.0.00280.1669
KNSWKnightSwan Acquisition0.00280.0597
XFINExcelFin Acquisition Corp.0.00280.0214
MITAColiseum Acquisition0.00290.021
CCVChurchill Capital Corp V0.0030.0226
TRTLTortoiseEcofin Acquisition III0.00310.0265
THCPThunder Bridge Capital Partners IV0.00340.0