---
title: "Seasonality in Python"
description: "Intraday patterns in futures. Preprocessing, backtesting, trade statistics and optimization."
url: "https://pythonparatrading.com/en/series/seasonality-in-python/"
lang: "en"
image: "https://pythonparatrading.com/og/en/series/seasonality-in-python.png"
---

# Seasonality in Python

> Intraday patterns in futures. Preprocessing, backtesting, trade statistics and optimization.

Complete · 04/04 parts

The series builds, step by step in Python, a system to search for intraday seasonal patterns in futures: from 1-minute data to a search that tests every entry combination. Some Python and pandas is enough; the backtester is written from scratch with pandas masks.

[Part 1](https://pythonparatrading.com/en/seasonality-intraday-preprocessing/) defines intraday seasonality and its causes, builds a 6E continuous future with a calendar roll and resamples 1-minute bars to 15 minutes. [Part 2](https://pythonparatrading.com/en/seasonality-intraday-backtesting/) writes the `IntradaySeasonalBacktester` class: it enters by weekday, hour and minute, exits after N bars and returns the trade history in points. [Part 3](https://pythonparatrading.com/en/seasonality-intraday-statistics/) computes SQN, VaR and CVaR, alpha, beta, maximum drawdown and the Sharpe ratio on that history. [Part 4](https://pythonparatrading.com/en/seasonality-intraday-optimization/) sweeps every weekday, hour, minute and bar combination with `itertools` and saves the metrics to a CSV.

The result is a custom backtester and a table of metrics per parameter combination: the starting point for finding seasonal edges.

## Parts

1. [Seasonality in Python. Searching for Intraday Patterns](https://pythonparatrading.com/en/seasonality-intraday-preprocessing/) · 2025-04-07 — After a long period completely disconnected, we return to writing some notes for you. On this occasion, we are going to program from scratch a complete research process, and…
2. [Seasonality in Python II - Backtesting](https://pythonparatrading.com/en/seasonality-intraday-backtesting/) · 2025-04-08 — Discover how to identify intraday seasonal patterns in futures and validate trading strategies through backtesting. Learn to use Python to analyze historical data, optimize…
3. [Seasonality in Python III - Statistics on Trading](https://pythonparatrading.com/en/seasonality-intraday-statistics/) · 2025-04-10 — In this article, we analyze the Sharpe ratio, Value at Risk (VaR), Conditional Value at Risk (CVaR), the System Quality Number (SQN), and other relevant ratios to analyze the…
4. [Intraday Seasonality IV - Field Search](https://pythonparatrading.com/en/seasonality-intraday-optimization/) · 2025-04-14 — In this installment, we expand the backtester to use it as a broad-spectrum search engine to find seasonal edges. We run a backtest on all the necessary parameters to analyze the…
