Alexander Hübbert
  • Home
  • Research
  • Articles
  • Practical Coding
  • Data Sources
  • Quant Quiz
  • Tools
    • Valuation Calculator
    • DerivaSteps
  • CV

Articles

Articles

Here I share my longer write-ups with code. Readers who want to start from the foundations can use Practical Coding, where Python and R are taught.

Dec 1, 2026

Does the Santa Claus rally still work? 100 years of data

The Santa Claus rally has lost its edge. From 1926 to 1950, the Santa Claus week beat the other month-ends by 1.90 percentage points on average, but from 2001 to 2025 by only 0.05.

Analysis Python
Read article
The average difference between the Santa Claus week and the other month-ends of the same year, in percentage points, for four 25-year periods: 1.90 in 1926 to 1950, 1.72 in 1951 to 1975, 0.72 in 1976 to 2000 and 0.05 in 2001 to 2025, drawn as a white line on a red background with snowflakes.
Nov 26, 2026

Börsdata API in Python: download prices, reports and ratios

I show how to download Börsdata's daily stock prices, company reports, and ratios such as P/E in Python, compute free cash flow yield, then convert them into panels and save them as three CSV files.

API Data Sources Tutorial Python
Read article
downloading Börsdata stock data in Python
Nov 26, 2026

Fear and greed, part 2: does smoothing the index help?

Smoothing my fear and greed index reduces switching in a buy-in-fear, sell-in-greed rule. Only one version beat staying invested, with a single switch in 1937.

Backtesting Analysis Python
Read article
The value of $1 from October 1927 to September 2026 on a log scale with the buy-in-fear, sell-in-greed rule on five versions of my fear and greed index: $16,461 on the 252-day exponential moving average, $512 on the index without smoothing, $462 on the 63-day exponential moving average, $417 on the 63-day rolling average and $47 on the 252-day rolling average, against $12,919 staying invested.
Nov 25, 2026

Can you spot the mistakes in this machine-learning test of return forecasts?

When I was new to machine learning, I made several mistakes in a course assignment. Can you spot them before I list them?

Machine Learning Backtesting Tutorial Python
Read article
The years 2000 to 2019. Signals 1 and 2 predict returns from 2000 to 2009, and no signal predicts returns from 2010 to 2019. My method's random split puts training and test rows into every year and gives OLS an R² of +0.79%. The corrected split in time order has training data from 2000 to 2014 and test data from 2015 to 2019 and gives OLS an R² of −1.60%.
Nov 24, 2026

How to download SEC Schedule 13D data in Python

I show you how to download U.S. Securities and Exchange Commission Schedule 13D filings for free in Python and convert them into a panel dataset.

Data Sources Tutorial Python
Read article
downloading SEC Schedule 13D data in Python
Nov 24, 2026

How to download SEC 13F holdings data in Python

I show how to download U.S. Securities and Exchange Commission 13F holdings data for free in Python and convert it into a panel with report date, manager, security, shares in millions, and value in millions of U.S. dollars.

API Data Sources Tutorial Python
Read article
downloading SEC 13F holdings data in Python
Nov 23, 2026

Fear and greed index backtest since 1927: buying in fear trailed staying invested

I create my own fear and greed index to backtest how a rule buying when fear is high and selling when greed is high has worked since 1927.

Backtesting Analysis Python
Read article
The value of $1 from October 1927 to September 2026 on a log scale: $12,919 staying invested and $512 buying in fear and selling in greed on my fear and greed index, with each strategy's drawdown below.
Nov 22, 2026

Download FRED data in Python with or without an API key

I show two free ways to download FRED's macroeconomic time series in Python, with and without an API key, using four daily Treasury yields as the example.

API Data Sources Tutorial Python
Read article
downloading FRED data in Python
Nov 22, 2026

How to download SEC Form 4 insider trading data in Python

I show how to download U.S. Securities and Exchange Commission insider trading data for free in Python and convert it into a readable DataFrame with ticker, trade date, reporting owners, price, and filing date.

Data Sources Tutorial Python
Read article
downloading SEC insider trading data in Python
Nov 20, 2026

Validation set vs test set: choosing the ridge penalty in Python

OLS always has the lowest MSE on the data it is fitted to, yet in this simulation ridge regression has a lower MSE than OLS on the test data. I show what the training, validation, and test data each do in Python.

Machine Learning Tutorial Python
Read article
Ridge's MSE minus OLS's MSE against the penalty on a log scale. On the training data, the difference rises from 0 to 1.21 as the penalty grows. On the validation data, it falls to minus 0.51 at a penalty of about 251 and then rises to minus 0.38.
Nov 13, 2026

Event-study abnormal returns: correcting market-model bias for large stocks

The market model can understate or overstate a large stock's abnormal returns in an event study because the assumptions needed to estimate them may be violated. I show why, and how to fix it, in Python.

Tutorial Python
Read article
S001's cumulative abnormal return from the day before its earnings announcement on 27 February 2024 to five trading days after. On day 5, the true value is 9.1%, Lally and Swidler's model gives 7.9% and the standard market model 6.2%.
Nov 13, 2026

Omitted variable bias in alpha: when factor exposure looks like skill

Two managers with the same average return and volatility can have the same alpha under the market model, although only one has skill. I show why this omitted-variable bias happens and how to fix it with the value factor in Python.

Factor Investing Tutorial Python
Read article
Alpha in percent per year of two simulated managers. Under the market model, both show 2.25. With HML added, the value manager's alpha is 0.00 and the skilled manager's stays at 2.25.
Nov 9, 2026

How ETFs are issued: mutual fund conversions and fund flows

How ETFs are issued in the United States and in Europe, how a mutual fund can be converted into an ETF, and how ETF flows reach the stocks in an ETF's basket.

Tutorial
Read article
Two lines of the assets of US ETFs and US mutual funds at the end of each year from 1993 to 2025. At the end of 2025, US ETFs held $13.4 trillion and US mutual funds $23.6 trillion. The mutual fund figures exclude money market funds.
Nov 9, 2026

How do closed-end funds, mutual funds and hedge funds differ?

Mutual funds, closed-end funds, and hedge funds differ in how investors can trade them, how efficient the trading price is, and how well the rules protect the investors.

API Tutorial Python
Read article
Bar chart of euro-area investment funds at the end of 2025. Most of the money in open-end investment funds was in UCITS funds, and all the money in closed-end investment funds was in alternative investment funds.
Nov 8, 2026

How does an LBO work? Financing and a leveraged buyout example

A leveraged buyout works by financing most of a company's purchase with debt, which can amplify returns but also the risk.

Tutorial
Read article
Bar chart of the return a year of two investors who buy the same company for $1,000 million, one with 60% debt and one without debt. If the business grows, the return is +16.2% a year with debt and +9.6% without. If it shrinks, it is minus 13.7% a year with debt and minus 1.4% without. The numbers are made up.
Nov 6, 2026

What does not fit can tell you the future

Be open-minded when you read about things that you do not grasp in full, or when something contradicts your view.

Opinion
Read article
A sketch of one company's share price. The price increases, then the company starts firing people. In one path, the company has become more efficient, and the price keeps increasing. In the other, the price does not move until worse times are obvious, and then it falls. The prices are made up.
Nov 3, 2026

Best-performing US industries since 1926: do winners stay winners?

In this post, I look at which of Kenneth French's 12 industries have been long-term winners, who the current winner is, and whether winners stay winners.

Analysis Python
Read article
Bars of the chance that the same industry is the winner 1 to 5 years after a win: 17.3%, 6.2%, 10.4%, 9.5% and 8.5%, with a dashed line at 10.9%, the share of all pairs of years that have the same winner.
Nov 2, 2026

Fama-French five-factor regression in Python: testing a portfolio's alpha

In this post, I show how to download the Fama-French factors in Python and test whether a portfolio has an alpha, with a portfolio of tobacco, alcohol, and defense stocks.

Factor Investing Tutorial Python
Read article
Three bars of the portfolio's alpha in points a year: 4.72 with the market factor only, 3.59 with three factors and 0.44 with five factors. The first two have t-statistics above 1.96, and the last has 0.34.
Oct 30, 2026

Post-earnings announcement drift: not significant from 2020 to 2025

After an earnings announcement, does a stock keep moving in the direction of its reaction, and has this post-earnings-announcement drift held over the last six years?

Analysis Python
Read article
Two charts of the return minus same-size stocks from day 1 to day 20 after an earnings announcement, for the strongest and the weakest reactions, from 2000 to 2025 and from 2020 to 2025. In the recent period the two lines lie closer together.
Oct 29, 2026

How to use Kenneth French's data library

In this post, I show how to use Kenneth French's data files and how he computes the factors himself.

Data Sources Factor Investing Tutorial Python
Read article
downloading data from Kenneth French's data library in Python
Oct 29, 2026

Momentum in small and large stocks: small-cap winners led

If I sort stocks by size and momentum, who wins when I compare returns in excess of the market?

Factor Investing Analysis Python
Read article
A 5 by 5 grid of Kenneth French's size and momentum groups from 1927 to 2025, with each group's average return a year minus the market's and the share of years it beat the market. The winners beat the market on average in every size group.
Oct 28, 2026

CAPE ratio backtest: time in the market vs timing the market since 1891

In this backtest, time in the market earns higher returns at the cost of larger drawdowns, while timing the market with CAPE can reduce them, but at the cost of lower returns.

Backtesting Analysis Python
Read article
The value of $1 after inflation from January 1891 to June 2026: $8,587 with time in the market and $350 with timing the market with CAPE, and each strategy's drawdown.
Oct 27, 2026

There is more to trading than technical analysis

Do not limit yourself to thinking that technical analysis is the only way in trading.

Opinion
Read article
A sketch of one trade. The share price falls, then moves sideways while the trader waits. At the trigger, the trader enters with a target above the entry and a price below it where the trader is wrong. One path rises to the target, and the other falls to the wrong price.
Oct 27, 2026

Dividends, buybacks or debt paydown: which part of shareholder yield pays?

From 2001 to 2026, the 30 large US stocks with the highest dividend yield beat the S&P 500 by 1.7 points a year after trading costs, those with the highest buyback yield beat it by 0.5 points, and those with the highest debt paydown yield trailed it by 1.1 points.

Backtesting Analysis Python
Read article
The value of $1 in the four portfolios and the S&P 500 from July 2001 to February 2026, after costs, and each portfolio's rolling five-year premium. Shareholder yield: 9.5% a year. Dividends: 10.9% a year. Buybacks: 9.8% a year. Debt paydown: 8.1% a year. S&P 500: 9.3% a year.
Oct 26, 2026

Active vs passive ETFs: how closely do they track their benchmarks?

From October 2023 to September 2026, the benchmark explained 99% or more of the variation in the monthly returns of 4% of 152 US active equity ETFs, and of 92% of 263 index ETFs.

API Analysis Python
Read article
A bar chart of the share of the 152 active ETFs and of the 263 index ETFs in each R² band. Under 80%: 40% of the active ETFs and 2% of the index ETFs. 80–90%: 20% of the active ETFs and 1% of the index ETFs. 90–95%: 19% of the active ETFs and 1% of the index ETFs. 95–99%: 17% of the active ETFs and 3% of the index ETFs. 99% or more: 4% of the active ETFs and 92% of the index ETFs.
Oct 25, 2026

Map an LEI to a PermID with LSEG in Python

A Python script that finds the LSEG PermID of each LEI in a list. On 24 test LEIs, it caught 2 typos and found the right company for the other 22.

API Data Sources Tutorial Python
Read article
mapping LEIs to LSEG PermIDs in Python, with a check-digit test before the lookup
Oct 20, 2026

Income and covered call ETFs: only 4 of 96 beat SPY

A distribution lowers a fund's price by the amount paid, and only 4 of 96 US income ETFs had a higher annual return than SPY over the same months.

API Analysis Python
Read article
A chart of three payout groups of US income ETFs against SPY, with the difference in annual return across and the difference in Sharpe ratio up. All three groups are below and to the left of SPY. The 66 funds paying under 5% a year returned 4.4 percentage points a year less than SPY, with a Sharpe ratio 0.28 lower. The 23 paying 5% to 10% returned 6.8 points less, with a Sharpe ratio 0.37 lower, and the 7 paying 10% or more 6.0 points less, with a Sharpe ratio 0.28 lower.
Oct 19, 2026

Asset allocation across economic environments: risk parity vs 60/40

Each asset class gains in some economic environments and loses in others, so a portfolio manager, unrestricted by any mandate, spreads a portfolio's risk across all of them.

Analysis Python
Read article
Growth of $1 after inflation from the end of 1970 to the end of 2025 in a 60/40 portfolio and in an equal-risk portfolio of US stocks, US Treasuries, gold and commodities. The 60/40 portfolio was worth less at the end of every year from 1973 to 1982 than at the end of 1972, and the equal-risk portfolio at the end of every year from 2013 to 2016 than at the end of 2012. $1 grew to $21 in the 60/40 portfolio and to $14 in the equal-risk portfolio.
Oct 17, 2026

How technology gained weight in the iShares MSCI Emerging Markets ETF

Technology companies made up 14% of the value of stocks held by iShares’ emerging-markets ETF at the end of 2007 and 49% in September 2026.

API Analysis Python
Read article
Stacked bars of four groups' shares of the stocks held by iShares' emerging-markets ETF, by value, at each year-end from 2007 to 2025 and in September 2026. Technology, at the bottom, is 14% in 2007 and 49% in September 2026. Energy and materials is 34% in 2007 and 9% in September 2026. Financials and everything else are above them.
Oct 17, 2026

How do ETFs work? Creation and redemption, step by step

Why an ETF's price stays close to its net asset value (NAV), and how authorized participants create and redeem its shares, step by step.

Tutorial
Read article
Diagram of a creation of ETF shares. A dealer buys stocks A, B and C for $100, delivers them to the ETF, gets a new ETF share and sells it on the exchange for $101. The price of an ETF share on the exchange is $101.00, and the ETF's net asset value per share is $100.00.
Oct 13, 2026

Growth stocks vs value stocks: faster revenue growth, lower five-year returns

Growth stocks grow faster than cheap stocks, but investors pay a higher price for that growth and earn less.

Backtesting API Analysis Python
Read article
Two panels by years after the sort, 0 to 5. Top: median revenue growth, with the most expensive fifth of large US stocks at 62% after five years, the cheapest fifth at 19% and the three middle fifths between them in order. Bottom: average total return, with the cheapest fifth highest at 77% and the most expensive fifth lowest at 61%.
Oct 9, 2026

The Markowitz curse: why minimum-variance weights can be unstable

When two stocks are highly correlated, raising one stock's estimated volatility from 20% to 20.2% changes the other stock's minimum-variance weight from 50% to 99.5%.

Tutorial Python
Read article
The minimum-variance weight in stock A as stock B's estimated volatility changes from 19.8% to 20.2%, with stock A's at 20%. At a correlation of 0.5, the weight is between 49% and 51%; at 0.99, it changes from 0% to 99.5%. Both lines pass through 50% where both estimated volatilities are 20%.
Oct 8, 2026

Smart beta ETFs: lower average Sharpe ratios in all seven strategies

From November 2015 to September 2026, the ETFs of all seven smart beta strategies had a lower average Sharpe ratio than their cap-weighted benchmarks.

Backtesting API Analysis Python
Read article
One dot per smart beta strategy: the average difference between three funds and their cap-weighted benchmarks in annual return, across, and in Sharpe ratio, up, from November 2015 to September 2026. All seven dots are below zero in Sharpe ratio, and only momentum is above zero in return.
Oct 6, 2026

ETF index rebalancing: little abnormal return for stocks entering or leaving USMV

From 2012 to 2025, stocks entering and leaving the MSCI USA Minimum Volatility Index returned about as much as its other stocks before the changes were implemented.

Backtesting API Analysis Python
Read article
Return of the stocks entering and leaving the MSCI USA Minimum Volatility Index relative to its other stocks over 2012 to 2025, from five trading days before the announcement to five after the rebalance. Both lines are close to zero at the rebalance day, and trading volume that day is far above normal.
Oct 2, 2026

Factor investing in Python: value and momentum, step by step

How to turn value and momentum into one score, select and weight 100 stocks, and rebalance them with trading costs, on simulated data.

Backtesting Factor Investing Tutorial Python
Read article
Simulated wealth of one dollar from the end of 2005 to 2025 on a log scale for a value and momentum portfolio before and after trading costs and for a cap-weighted benchmark of the same 500 stocks, with the portfolio lines above the benchmark.
Oct 1, 2026

Testing a stock characteristic as a factor in Python

How to go from an economic idea about a characteristic to the evidence that it is a factor, in five steps, with value on simulated data.

Backtesting Factor Investing Tutorial Python
Read article
Ten bars for the five book-to-market groups of half B of the simulated stocks: teal alphas against half A's market return, from -0.20% to 0.19% a month, and red alphas after adding half A's value spread, between -0.02% and 0.02% a month, each with a grey line for its 95% confidence interval.
Sep 30, 2026

Do large stocks crash more often after doubling?

Large US stocks that had doubled crashed more often than large stocks in general, and about as often as large stocks with similar past volatility that had not doubled.

Backtesting Analysis Python
Read article
Share of large US stocks that fell at least 40% from a peak within two years, by their gain over the previous two years, against all large stocks and against large stocks with similar past volatility and smaller gains.
Sep 25, 2026

AUC and calibration: good rankings can hide wrong probabilities

Halving every predicted probability of a crime leaves the AUC unchanged, while the probabilities then add up to about half the crimes that occur.

Machine Learning Market Surveillance Tutorial Python
Read article
Share of crimes against average predicted probability in ten bands of 1,000 announcements. The teal points for the original probabilities are close to the dashed line where the two are equal, and the red points for the halved probabilities are all above it.
Sep 25, 2026

Detecting unusual trading in broker records with an isolation forest in Python (part 2)

At a simulated broker, an isolation forest flags 36.3% of the purchases by illegal insiders who trade like prosecuted cases, and 1.1%, no better than chance, when they buy like ordinary buyers.

Machine Learning Market Surveillance Tutorial Python
Read article
Three bars of the share of the 91 insider purchases flagged: 36.3% for insiders like prosecuted cases, 1.1% for insiders like ordinary buyers, and 1.0% for three buyers per takeover chosen at random.
Sep 24, 2026

Detecting unusual trading in market data with an isolation forest in Python (part 1)

In a simulated market, an isolation forest flags only 6.4% of the days of illegal insider trading, because most of those days look like ordinary days.

Machine Learning Market Surveillance Tutorial Python
Read article
Two scatter charts of simulated stock-days, relative volume against standardised return. On the left, the isolation forest's alerts surround the cloud of stock-days on both sides and at the top. On the right, the volume-only rule's alerts are at the top only. Red circles mark the stock-days of insider trading, most of them inside the grey cloud below the alerts.
Sep 23, 2026

Monte Carlo option pricing: more simulations cannot fix a wrong volatility estimate

More simulations make an estimated option price more precise, but they leave the error from a wrong volatility input unchanged.

Tutorial Python
Read article
Estimates of the call option price at 20% volatility for 1,000 to 1,000,000 simulations. Their 95% simulation intervals get shorter around 9.41, the Black–Scholes price at 20%, and an arrow of length 3.87 marks the pricing error from the wrong volatility, the difference between that price and 13.28, the Black–Scholes price at 30%.
Sep 20, 2026

Logit vs probit: how to interpret the coefficients

What logit and probit coefficients mean for the probability of a crime.

Market Surveillance Tutorial Python
Read article
Three curves of predicted values against the information value of an announcement: a straight line from a linear regression that is below zero on the left and above one on the right, and two S-shaped curves from a logistic and a probit model that are between 0 and 1 throughout.
Sep 19, 2026

Asset class correlations with US stocks depend on which five years you measure

On monthly returns, US Treasuries had a correlation of −0.31 with US stocks over the five years to July 2013 and +0.53 over the five years to July 2026.

API Analysis Python
Read article
Six dots, one per asset class, at their correlation with US stocks over August 2021 to July 2026: US Treasuries +0.53, corporate bonds +0.69, gold +0.17, commodities +0.01, developed markets outside the US +0.78, emerging markets +0.64.
Sep 15, 2026

Why the 10-year Treasury yield near 5% is not a clear warning for stocks

After the 10-year Treasury yield was near 5%, the median US stock return over the next year was lower, almost entirely because of 2000 to 2002.

Analysis Python
Read article
Median US stock return 1 to 12 months after a month-end, 1964 to 2025. The orange line for month-ends with the 10-year yield near 5 percent is at 9.3 percent after 12 months, and the teal line for all month-ends is at 13.9 percent.
Sep 14, 2026

AUC vs accuracy: why 99% accuracy can mislead when crimes are rare

Accuracy can be a poor measure when crimes are rare. Two models with 99% accuracy on 100 traders have AUCs of 0.50 and 0.91.

Machine Learning Market Surveillance Tutorial Python
Read article
A magnifying glass over rows of white figures, with one red figure in the middle.
Sep 10, 2026

Why the 60/40 portfolio is not dead: sample choice matters

The stock-bond frontier changes with the sample period and the return frequency, so a reader should be careful not to conclude quickly whether bonds still diversify.

Backtesting API Analysis Python
Read article
Three stock-bond frontiers for 2021 to 2025, measured annually, monthly and daily. The annual curve is a straight line and the daily curve bends.
Sep 2, 2026

Portfolio sorts and Fama-MacBeth regressions in Python

Do stock characteristics associate with future returns? A portfolio sort and a Fama-MacBeth regression may give different answers, so it is good to do both.

Backtesting Factor Investing Tutorial Python
Read article
Five teal bars, the measured average returns of five groups of simulated stocks, at 0.64%, 0.61%, 0.66%, 0.57% and 1.47% a month, and a red fitted straight line that increases across all five groups, below the bars of groups 1 and 5 and above the bars of groups 2, 3 and 4.
Aug 31, 2026

How pandas dropna() cut ending wealth by 32.9% in a simulated backtest

In a simulated backtest, dropna() ends 32.9% below the true value, and forward-filling with the weekends handled ends within 0.05%.

Backtesting Tutorial Python
Read article
The value of 1.00 invested over twenty years in one simulated history, processed four ways: dropna() on everything ends lowest, stopping the row deletion ends higher, and also compounding the crypto weekend in ends on the truth.
Aug 18, 2026

Company name changes and stock returns: should you sell?

When a company changes its name, it is weakly associated with future returns. Still, when an unprofitable company changes its name, it is more strongly associated with negative future returns.

Backtesting API Analysis Python
Read article
The paired differences of matched renamers over the 12 months after the rename, with a median of -2.8 percentage points for 682 profitable and -13.4 for 365 unprofitable renamers.
Aug 11, 2026

Non-standard errors: same data, same signal, different answers

Even with the same data and the same trading signal, small choices in how you process the data can lead to different conclusions.

Backtesting Tutorial Python
Read article
A quant working at a laptop, for a post on how ordinary choices change a backtest's conclusion.
Jul 26, 2026

Six biases that distort quant research, measured where the truth is known

Five of the six biases make a worthless result look valuable, and one makes a good strategy look bad.

Tutorial Python
Read article
An open book beside a laptop showing a chart, for a post on biases in quantitative research.
Jul 25, 2026

Backtest overfitting: when out-of-sample becomes in-sample

If you keep changing the strategy according to what you observe out of sample, the out-of-sample data becomes in-sample, and the edge you claim to have found is mostly noise.

Backtesting Tutorial Python
Read article
A control panel labelled Strategy Parameters, with knobs for lookback, volatility filter, size screen, momentum tilt and weight limit.
Jul 24, 2026

Download US insider trading data from LSEG Workspace in Python

How to download insider trading data for about 10,000 US stocks from LSEG Workspace in Python, with a script that picks up where it left off if it stops.

API Data Sources Tutorial Python
Read article
downloading US insider trading data from LSEG in Python
Jul 24, 2026

Download US IPO data from LSEG Workspace in Python

A Python script that downloads every US IPO since 1988 from LSEG, delisted companies included, and keeps the operating companies.

API Data Sources Tutorial Python
Read article
downloading US IPO data from LSEG in Python
Jul 23, 2026

Does buying the dip work? US vs European stocks, net of trading costs

Buying the dip beat the market in the US after small falls and roughly matched it after deep ones, but in Europe it trailed the market after falls of 10% or more, and the deeper the fall, the more it trailed.

Backtesting Analysis Python
Read article
Median 12-month abnormal return after a drawdown, US against Europe, by drawdown threshold.
Jul 20, 2026

Buying the S&P 500 every month usually beat waiting for new highs or lows

Waiting for new S&P 500 highs or lows to invest usually earned less over ten years than investing every month.

Backtesting Analysis Python
Read article
Difference in annual IRR for two waiting rules, against the length of the new high or low window in months.
Jul 19, 2026

Interactive Brokers API in Python: download historical prices with ib_async

How to connect Python to Interactive Brokers with ib_async and download a year of daily prices into pandas.

API Data Sources Tutorial Python
Read article
downloading daily prices from Interactive Brokers in Python
Jul 19, 2026

Trading costs more than halved a Swedish momentum strategy's ending value

From 2001 to 2025, trading costs cut one krona's growth in Swedish momentum from 358 kronor to 156, still ahead of the market's 55.

Backtesting Analysis Python
Read article
Momentum on Swedish stocks against the market, 2001 to 2025, before and after costs.
Jul 19, 2026

S&P 500 returns in six currencies: highest in Swedish kronor, lowest in Swiss francs

From 1988 to 2026, the S&P 500 multiplied an unhedged investment 109.7 times in Swedish kronor and 41.1 times in Swiss francs.

Backtesting Analysis Python
Read article
Growth of one unit in the S&P 500 total return, in six home currencies, 1988 to 2026.
Jul 18, 2026

The Magic Formula worked. Just not lately.

Greenblatt's Magic Formula returned 11.1% a year after trading costs, against 8.7% for the S&P 500 from 2001 to 2026, and has trailed it since about 2015.

Backtesting Analysis Python
Read article
Magic Formula portfolio against the S&P 500, 2001 to 2026, with a rolling five-year premium.
Jul 17, 2026

The longer you hold a stock, the less likely you are to beat the market

From 2000 to 2026, 45.7 percent of US stocks beat the S&P 500 over one year, and 27.0 percent over fifteen years.

Backtesting Analysis Python
Read article
Share of US stocks that beat the S&P 500, decreasing from 45.7 percent at one year to 27.0 percent at fifteen, 2000 to 2026.
Jul 16, 2026

Purged cross-validation in Python: why a model with no predictive power can score 90% accuracy

Training labels that reach into the test period can raise a model’s accuracy on returns with no signal to 90.5%, and dropping those training days drops it to 50.3%.

Machine Learning Backtesting Tutorial Python
Read article
Diagram showing how purging prevents training outcomes from overlapping the test period.
Jul 13, 2026

Sharpe ratio bootstrap in Python: the best of 216 strategies reached 0.72 by chance

In a simulated market with no edge, the best of 216 strategies has a Sharpe ratio of 0.72, which, by searching alone, matches or beats 41% of the time.

Backtesting Tutorial Python
Read article
Sharpe ratio bootstrap in Python: the best of 216 strategies reached 0.72 by chance
Jul 12, 2026

LSEG Tick History REST API in Python: download trades and quotes

A Python script that downloads every trade and quote for a list of stocks from LSEG Tick History and restarts where it stopped.

API Data Sources Tutorial Python
Read article
downloading tick data from LSEG Tick History in Python
Jul 10, 2026

IPO booms gave little warning of weak S&P 500 returns over the next year

From 1988 to 2025, an IPO boom was no stable warning, because in the following year the S&P 500 returned within a few points of its average.

Backtesting Analysis Python
Read article
Next-12-month S&P 500 abnormal return by prior-year IPO intensity threshold.
Jul 8, 2026

Correlation vs cointegration: simulating butter prices and the S&P 500

Two unrelated simulated series have a correlation of 0.93 because both drift upward, but they fail a cointegration test.

Backtesting Tutorial Python
Read article
Correlation vs cointegration: simulating butter prices and the S&P 500
Jul 5, 2026

How to write better

Five rules from Jacobsen and McCloskey for stating your point directly, each with an example before and after.

Opinion
Read article
How to write better
Jul 3, 2026

IPO returns: larger IPOs pop more, pricier profitable IPOs return less in year one

Sorted by price-to-earnings ratio at the offer, the cheapest quarter of profitable US IPOs returned a median of 13.0% in their first year, against −2.1% for the priciest.

Backtesting Analysis Python
Read article
Median first-day pop, day-one open-to-close, one-month and one-year return by US IPO size bucket, 2000 to 2025.
Jun 30, 2026

Can Elo ratings predict World Cup match winners?

At the 2014, 2018 and 2022 World Cups, Elo ratings predicted how often the favorite won, counting a draw as half, to within 3 percentage points.

Backtesting Analysis Python
Read article
Can Elo ratings predict World Cup match winners?
Jun 24, 2026

Quality factor backtest: the most profitable US stocks beat the S&P 500

From 2000 to 2026, the 30 most profitable US companies returned 9.7% a year after costs, against 8.1% for the S&P 500 and −0.4% for the 30 least profitable.

Backtesting Analysis Python
Read article
Growth of one dollar and drawdown for high-quality against low-quality US companies, 2000 to 2026.
Jun 8, 2026

How to backtest a trading strategy in Python with bt

A monthly momentum strategy backtested end-to-end in Python with the bt library, on simulated data, before and after trading costs.

Backtesting Tutorial Python
Read article
How to backtest a trading strategy in Python with bt
Jun 3, 2026

How did diversified portfolios do when US stocks rose or fell?

From 1988 to 2026, three diversified portfolios typically lost less than the S&P 500 in its falling months and gained less in its rising months.

Backtesting Analysis Python
Read article
How did diversified portfolios do when US stocks rose or fell?
May 27, 2026

Detection-controlled estimation in Python: the frequency of market crimes

From a prosecution rate of 5%, Detection-Controlled Estimation estimates a crime rate of 23%, where the simulated true rate is 25%.

Market Surveillance Tutorial Python
Read article
Three bars for the crime rate among 10,000 simulated announcements: 5.0% counted from prosecutions, 22.9% estimated by Detection-Controlled Estimation, and a true rate of 25.3%.
May 24, 2026

How persistent is a firm's cost of capital (WACC) relative to other firms?

Across US firms, the correlation between a firm's cost of capital today and one year later averages 0.67, and five years later 0.23.

Analysis Python
Read article
How the cross-sectional correlation of WACC and its components decays over one to five years.
May 20, 2026

Dividend yield backtest: the 30 highest-yielding US stocks lagged the S&P 500

The 30 highest-yielding US stocks returned 7.9% a year after trading costs from 2012 to 2026, against 15.0% for the S&P 500.

Backtesting API Analysis Python
Read article
Dividend yield backtest: the 30 highest-yielding US stocks lagged the S&P 500
May 11, 2026

Does a large one-day move in the S&P 500 predict next week's return?

The S&P 500's median next-week return was far from zero only after one-day moves of 5% or more, and opposite in sign to those moves.

Backtesting Analysis Python
Read article
Does a large one-day move in the S&P 500 predict next week's return?
Apr 24, 2026

Bessembinder revisited: about 5% of stocks created all the net wealth

From 2000 to 2026, 5.4% of US stocks and 4.4% of European stocks created all the net wealth, the total gain above Treasury bills, repeating Bessembinder's finding.

Analysis Python
Read article
Cumulative share of net wealth created by the top few percent of stocks, US and Europe.
Apr 22, 2026

Insider buying backtest: beat the S&P 500 after costs from 2001 to 2026

Following insider buyers beat the S&P 500 from 2001 to 2026 after costs, 15.1% a year against 9.1%, and trailed it over the last five years.

Backtesting API Analysis Python
Read article
Insider buying backtest: beat the S&P 500 after costs from 2001 to 2026
Apr 20, 2026

Opportunistic vs routine insiders: how to classify them in Python

How to label an insider as routine or opportunistic in Python, from the calendar months of their trades over the three previous years.

Tutorial Python
Read article
Four panels, one per insider, with one dot per trade at its year and calendar month. Alexander trades every March and his dots are teal, Routine, from 2018; Beatrice never repeats a month and her dots are red, Opportunistic, from 2018; Cecilia's June trades in odd years and Diana's single trade are grey, NonClassified.
Apr 10, 2026

Download daily prices for listed and delisted stocks with LSEG Workspace in Python

A copy-and-paste Python script for getting stock data in LSEG Workspace: daily data since 2000 for the stocks of any country (including delisted ones), all in one CSV, plus how to find the field code for any variable. The example is Sweden, with about 1,655 stocks.

API Data Sources Tutorial Python
Read article
downloading stock data from LSEG Workspace in Python

Categories

No matching items
Alexander Hübbert

Postdoctoral Researcher in Finance.

Home Research Articles Practical Coding Data Sources Quant Quiz Valuation Calculator DerivaSteps CV
LinkedIn Email
© 2026 Alexander Hübbert · This site counts visits with Cloudflare Web Analytics, which sets no cookies.