Open Family Office Datasets Tickers Strategies Portfolios Research Posts About Changelog

Tesla Stock Price Prediction: ARIMA, Fourier Features and XGBoost

Source

Citation. Infi-09. "Tesla-Stock-Price-Prediction". GitHub repository, Infi-09/Tesla-Stock-Price-Prediction, created 8 November 2021, read at commit a57f2aa. It holds two Jupyter notebooks, tesla.csv with Tesla's daily bars from 29 June 2010 to 17 March 2017, a README and pinned dependencies. It has no licence, so this page quotes short phrases and copies no code.

Status. Not applicable. It is a small public example of the usual faults, and it serves as a test case for the harness. Its ARIMA does slightly worse than yesterday's close. Its XGBoost is given the target as an input. Its "Fourier" feature is a frequency-domain array laid against dates.

Read. Read on 2026-11-28 by raw download at commit a57f2aa. I read the code cells of both notebooks and their saved outputs, and tesla.csv, 1,692 rows. I didn't re-run the notebooks: they pin statsmodels==0.11.1, whose statsmodels.tsa.arima_model.ARIMA has since been removed. Instead, I computed the baselines and the leak on tesla.csv with NumPy. Those numbers are mine.

Summary

What the notebooks do.

What I measured.

Check Result
Yesterday's close as the forecast, the notebook's 70/30 split, 508 test days one-step MSE 28.760
The notebook's ARIMA(5,1,0), same split one-step MSE 28.940, from its saved output
Least squares of the day's close on the same day's open, high and low, the last 35% held out R² 0.994
Least squares of the next day's log return on today's R² 0.001

Where the claims go beyond the evidence

ARIMA loses to a random walk. On the same 508 test days, the forecast "tomorrow equals today" has a lower error, at 28.760 against 28.940. An ARIMA(5,1,0) on prices is close to a random walk, and here it is slightly worse. The notebook never computes the baseline.

The XGBoost model is given its answer. The features are columns 1 to 18 of the table. Those include Close, the target itself, and Adj Close, which equals Close in this file. They also include the same day's open, high and low, and moving averages that contain the day's close. Even without the target column, the same day's open, high and low explain 99.4% of the close's variance, in my test. A high feature importance or a low error then says nothing about forecasting.

The "Fourier" column isn't a time series. After the loop, fft_list_m10 holds the FFT coefficients with all but the lowest 100 frequencies set to zero. The notebook takes their absolute values and assigns them to featured_tesla['Fourier'], one per row. So row k holds the size of frequency k, set against the k-th date. It also comes from the whole 2010–2017 series, so even a correct reconstruction would use the future.

Bugs that change results.

The metrics measure price levels. MSE on price levels, and "accuracy" on prices rounded to whole dollars, don't measure skill that can be traded. There are no returns, no direction, no costs and no trading test.

Credit. The ARIMA is fitted in a rolling, one-step way, refitted on each new day, which is the right form. The notebooks are short and public, so each fault can be checked.

Use in this repo

Each fault, and the check that catches it.

Fault Check
No baseline Compare every forecast with a random walk on returns, by scoring.compare's Diebold–Mariano test (#109)
The target among the features Fit features on data up to t and predict t + 1, by the splitters (splits.py, #10). The look-ahead oracle can't see a leak inside a strategy's own features (#87), so this check is the strategy's
Whole-sample FFT Compute any spectral feature on a rolling, past-only window (fourier-stock-volatility.md)
A mislabelled indicator Test each indicator against a reference implementation, such as TA-Lib (#196)
Notebooks that don't run in order Accept only results that a clean run reproduces
Price-level metrics Score returns, direction and P&L after costs (#8, #9)

A worked case for RQ1. The repository is small enough to rebuild inside the harness as a planted-fault test. The same model, run with the target among its features, should fail. Run honestly on next-day returns, it should show no skill, as the R² of 0.001 suggests (#5).