Quantitative Portfolio Management: Long-Short and Market Neutral
Module: Fintech AI | Difficulty: Advanced
Market Neutral
Long-Short
Factor Neutral
where = factor loadings.
Portfolio Construction
import numpy as np
from scipy.optimize import minimize
class LongShortPortfolio:
def __init__(self, alpha, cov, beta, risk_aversion=1.0):
self.alpha = alpha; self.cov = cov; self.beta = beta; self.lam = risk_aversion
def optimize(self):
n = len(self.alpha)
def neg_utility(w):
return -(w @ self.alpha - self.lam/2 * w @ self.cov @ w)
constraints = [
{'type': 'eq', 'fun': lambda w: np.sum(w)}, # market neutral
{'type': 'eq', 'fun': lambda w: w @ self.beta} # factor neutral
]
bounds = [(-0.05, 0.05) for _ in range(n)]
w0 = np.zeros(n)
result = minimize(neg_utility, w0, bounds=bounds, constraints=constraints)
return result.x
Research Insight: Market neutral portfolios eliminate market risk, isolating alpha. The key challenge is that factor exposures change over time, requiring ongoing rebalancing. Transaction costs can consume 50%+ of alpha in high-turnover market neutral strategies.