Autocorrelation Properties of SP500-Quantitative Trading in Python

Follow us on LinkedIn

A technical or quantitative trading system on a linear (i.e. delta 1) instrument is basically a bet on the autocorrelation of the underlying. The autocorrelation properties of the underlying can be examined directly through autocorrelation functions or indirectly through the Hurst exponent.

In this post, we are going to examine the mean-reverting and trending properties of SP500 directly using the autocorrelation functions. We do so with the goal of designing quantitative trading systems on stock indices.

Recall that,

Autocorrelation, also known as serial correlation, is the correlation of a signal with a delayed copy of itself as a function of delay. Informally, it is the similarity between observations as a function of the time lag between them. The analysis of autocorrelation is a mathematical tool for finding repeating patterns, such as the presence of a periodic signal obscured by noise, or identifying the missing fundamental frequency in a signal implied by its harmonic frequencies. It is often used in signal processing for analyzing functions or series of values, such as time domain signals. Read more

We implemented the autocorrelation functions in Python. We downloaded SPY data from 2009 to the present from Yahoo Finance. We then applied the Python program to the daily and monthly returns of SPY.

The graph below shows the autocorrelation (ACF) and partial autocorrelation (PACF) functions of daily SPY returns. We note that SPY returns are negatively correlated at lags 2-4, i.e. SPY is mean-reverting in the short term. This is consistent with the findings in the previous study performed using the Hurst exponent.

Quantitative Trading in Python

The graph below shows the autocorrelation and partial autocorrelation functions of monthly SPY returns. We observe that the monthly returns are positively correlated around lag 9. This means that in a long term, SPY is trending.

Quantitative Trading in Python

In summary, using the autocorrelation functions, we demonstrated that the SP500 is mean-reverting in the short term and trending in the long term. In the next installments, we will design trading systems based on the mean-reverting and trending properties of SPY.

Further questions

What's your question? Ask it in the discussion forum

Have an answer to the questions below? Post it here or in the forum

LATEST NEWSLophos Holdings Inc. Celebrates Successful Conclusion of Inaugural Annual General Meeting, Confirms Board Members and Stock Options Plan
Lophos Holdings Inc. Celebrates Successful Conclusion of Inaugural Annual General Meeting, Confirms Board Members and Stock Options Plan

VANCOUVER, British Columbia, March 28, 2024 (GLOBE NEWSWIRE) — Lophos Holdings Inc. (CSE: MESC) (“Lophos” or the “Company“) is pleased to announce all matters presented for approval at the annual general meeting of the shareholders of the Company held earlier today March 28, 2024 (the…

Stay up-to-date with the latest news - click here
LATEST NEWSSome cancer patients can find it hard to tell family and friends about their diagnosis: ‘You’re dealing with this all alone’
Some cancer patients can find it hard to tell family and friends about their diagnosis: ‘You’re dealing with this all alone’

Not everyone is eager to share upsetting medical news, even with loved ones

Stay up-to-date with the latest news - click here
LATEST NEWSBattle for Disney board seats heats up as votes come in, Blackwells sues
Battle for Disney board seats heats up as votes come in, Blackwells sues
Stay up-to-date with the latest news - click here
LATEST NEWSExcellon Closes Debenture Restructuring
Excellon Closes Debenture Restructuring
Stay up-to-date with the latest news - click here
LATEST NEWSLiberty Gold Reports Year-End 2023 Financial and Operating Results
Liberty Gold Reports Year-End 2023 Financial and Operating Results

VANCOUVER, British Columbia, March 28, 2024 (GLOBE NEWSWIRE) — Liberty Gold Corp. (TSX:LGD; OTCQX:LGDTF) (“Liberty Gold” or the “Company”), is pleased to announce its financial and operating results for the fiscal year ended December 31, 2023. All amounts are presented in United States dollars unless…

Stay up-to-date with the latest news - click here

2 Comments

Leave a Reply to Harbourfront Technologies Cancel reply