← Back to Learn
IV ExpertWeek 20 • Lesson 61Duration: 30 min

BKT Basket Trading

PCA-driven baskets — extracting mean-reverting components from multi-asset portfolios

Learning Objectives

  • Understand PCA-based basket construction
  • Apply PCA to extract mean-reverting components from correlated assets
  • Implement practical basket trading strategies

Explain Like I'm 5

Instead of trading pairs (2 assets), basket trading extends to N assets using PCA (Principal Component Analysis). PCA decomposes a group of correlated assets into independent components. The first component (PC1) captures the market factor — it trends. The higher components (PC2, PC3) capture relative value — they mean-revert. Trade the mean-reverting components, ignore the trending one. You just turned N correlated assets into clean, independent signals.

Think of It This Way

Imagine an orchestra. PCA identifies: the whole orchestra playing louder/softer (PC1 — the market trend), then violins being louder than cellos (PC2 — relative value between sections), then the brass section slightly offbeat (PC3 — another relative relationship). You don't want to bet on volume changes (PC1). You want to bet on the orchestra getting back in balance (PC2, PC3). Those components mean-revert.

1PCA-Based Baskets

PCA on a matrix of returns from multiple correlated assets produces orthogonal components: PC1 (first principal component): Captures the dominant shared factor. In FX, this is USD strength. In equities, this is market beta. This component TRENDS. Do not trade it for mean reversion. PC2, PC3, ... (higher components): Capture relative value between assets. These components tend to MEAN-REVERT because they represent temporary mispricings among otherwise related assets. The PCA basket construction process: 1. Take daily returns for N correlated assets 2. Compute the covariance matrix 3. Run PCA to get eigenvectors (loadings) and eigenvalues (variance explained) 4. PC1 loadings give the "market" portfolio 5. PC2/PC3 loadings give the "relative value" portfolios 6. Trade PC2/PC3 like single-instrument mean reversion (z-scores, OU model, etc.) This is literally what institutional stat arb desks do. Pairs trading is just PCA with N=2. Basket trading is PCA with N=10, 20, or 100.

2Practical Basket Construction

Step-by-step process for production-quality baskets: 1. Choose your universe. Pick 5-15 related instruments. For FX: the G10 currencies. For metals: gold, silver, platinum, palladium. Instruments must be fundamentally related. 2. Compute returns matrix. 200+ days of daily returns, standardized. 3. Run PCA. First 2-3 components typically explain 80%+ of variance. Everything beyond is noise. 4. Analyze loadings. PC1 will have all positive loadings (common factor). PC2 will have some positive, some negative (relative value). 5. Form the basket. Use PC2 loadings as portfolio weights. Long the positive loadings, short the negatives. This gives you a dollar-neutral, relative-value portfolio. 6. Trade the basket. Compute the basket's value over time. If it mean-reverts, trade it with standard z-score rules. The advantage over pairs: diversification across N assets reduces single-pair blowup risk. If one relationship breaks, you still have N-1 other relationships holding the basket together.

Key Formulas

PCA Decomposition

The covariance matrix of returns is decomposed into eigenvectors (W) and eigenvalues (Lambda). Each principal component k is a weighted combination of individual returns, where the weights come from the k-th eigenvector.

Hands-On Code

PCA Basket Construction

python
import numpy as np
from sklearn.decomposition import PCA

def pca_basket(returns_matrix, asset_names, n_components=3):
    """Construct PCA-based trading baskets from correlated assets.
    
    returns_matrix: (n_obs, n_assets) array of returns
    """
    pca = PCA(n_components=n_components)
    components = pca.fit_transform(returns_matrix)
    
    print(f"=== PCA BASKET ANALYSIS ===")
    print(f"Assets: {', '.join(asset_names)}")
    print(f"Observations: {returns_matrix.shape[0]}")
    print(f"")
    
    for i in range(n_components):
        var_pct = pca.explained_variance_ratio_[i] * 100
        loadings = pca.components_[i]
        print(f"PC{i+1} ({var_pct:.1f}% variance):")
        for name, w in zip(asset_names, loadings):
            direction = 'LONG' if w > 0 else 'SHORT'
            print(f"  {name}: {w:+.3f} ({direction})")
        print()
    
    # Use PC2 as the relative-value basket
    rv_basket = components[:, 1]  # PC2 values over time
    z = (rv_basket - np.mean(rv_basket)) / np.std(rv_basket)
    
    print(f"PC2 Basket (Relative Value):")
    print(f"  Current z-score: {z[-1]:.2f}")
    if abs(z[-1]) > 2.0:
        print(f"  [SIGNAL] Trade the basket")
    else:
        print(f"  No trade signal")
    
    return components, pca.components_, z

Constructs PCA-based baskets from multiple correlated assets, identifies the mean-reverting components, and generates trading signals on the relative-value basket.

Knowledge Check

Q1.In PCA of G10 FX returns, what does PC1 typically represent?

Assignment

Build a PCA-based basket from 5+ correlated FX pairs. Identify which principal components mean-revert. Backtest a z-score strategy on the relative-value component.