How to Track Flight Prices With a Fare Calendar Matrix

Published:

10 minute read

Acar Diveroli
Written by: Acar Diveroli
Flat triangular calendar matrix; one departure day's column runs to the diagonal in blue tiles, ending in a plane icon

Fare calendar tracking is the method of querying the price of the same route every day under the same conditions and writing the result into a table with two axes: query day and departure day. Rows show the day you took the measurement, columns show the flight date. The trap is in the constants. If the currency, passenger count or point of sale changes between two days, the difference in the table comes from the settings, not the price. In this post we cover the calendar matrix, the fixed parameters, query frequency, the record schema and how to read the result.

The calendar matrix

A calendar matrix is a table with two date axes: query day in the rows, departure day in the columns. Each cell holds the lowest price seen on that day for that flight date. The monthly calendar you see in a single search is just one row of this table.

The matrix can be read in three directions:

DirectionWhat it showsQuestion it answers
RowThe calendar seen on one dayWhich departure day is cheap today?
ColumnOne flight date's price pathHow did this flight change over time?
DiagonalCells with the same days left to departureWhat does the price do as departure nears?

The real information is in the column. A search site's calendar only shows you today. The column shows how the same seat was priced over weeks. We explained why prices move during the day in our post on dynamic pricing. This post is about measuring that movement.

Parameters to keep fixed

Two cells in the matrix are comparable only if they were measured with the same search settings. If one setting changes, the difference is a measurement error. So before the measurement starts, write down these values and never change them:

ParameterExample valueWhy fixed
Origin and destinationSAW → LHR (airport code)A city code (LON) covers several airports
Passengers1 adultWithout enough seats in the cheap class, the total rises
CabinEconomyEach cabin is a separate fare list
Trip typeOne way or a fixed length of stayRound trip adds a third axis to the table
CurrencyEURExchange rate moves look like price changes
Point of saleSame country versionA market can open a different fare list
Fare brandSame ticket type (e.g. no bag)When the cheapest brand closes, the price jumps

If you track round trips, fix the length of stay, for example 7 nights. The return date then derives from the departure and the table stays two-dimensional. If you want to measure several lengths of stay, keep a separate matrix for each.

The point of sale is the setting that drifts most easily. Many sites pick the country version from your IP address on the first visit. If your script runs from a home connection one day and from a server abroad the next, the two rows come from different markets. We covered the reasons behind price gaps between countries in why flight prices change by country. Here it is enough to lock the market to a single value.

Data source and request rate

The first choice is an official channel. If the airline or search site offers a developer or partner API, use it. In an API, the market, currency and passenger count go in as parameters. That is the cleanest way to hold these constants. The standard for offer data between airlines and agencies is IATA's NDC program. Access usually requires an agreement.

If the source is a public page, follow the site's terms and robots.txt. Keep the rate low: queue requests, leave a few seconds between them and stop when you see 429 Too Many Requests. If the response carries Retry-After, wait that long. Rate settings are covered in detail in our post on request rate.

A proxy helps here with a fixed market, not with speed. A site that picks its country version from the IP address shows the same version if your queries leave from the same country every day. For a job that wants the same IP every day, a ISP Proxy fits. The exit address does not change from day to day, so market drift drops off the diagnosis list.

If the page has a monthly calendar view, prefer it. A single response returns every departure day of a month. Instead of asking for each day separately, you fill the row with one request per month.

Query frequency and time

One measurement a day, at the same hour, is enough for the matrix, because one cell in a column is one day. Hourly measurements do not split the cell. They only add noise and load. If you are curious about intraday movement, measure it separately on a small sample.

The daily request count is a simple product: routes × departure days × lengths of stay. Tracking 60 one-way departure days on one route means 60 queries a day. Add three lengths of stay to the same route and the number rises to 180. With a calendar view, it drops to the number of months.

Compute the query day in a single time zone. Servers usually run on UTC, while you think in Türkiye time. The two split near midnight and a measurement lands in the wrong row.

python
from datetime import datetime, timezone
from zoneinfo import ZoneInfo

now = datetime.now(timezone.utc)
# record time: RFC 3339, UTC
observed_at = now.isoformat(timespec="seconds").replace("+00:00", "Z")
# query day: always in Türkiye time
query_date = now.astimezone(ZoneInfo("Europe/Istanbul")).date().isoformat()

If zoneinfo cannot find time zone data on Windows, add it with pip install tzdata.

Record schema

Each query becomes one row and carries every fixed parameter. Writing the parameters into the row lets you answer "were these two cells measured with the same settings" with a query later.

sql
CREATE TABLE fare_obs (
  observed_at  TEXT NOT NULL,     -- RFC 3339, UTC: 2026-12-03T06:00:00Z
  query_date   TEXT NOT NULL,     -- query day, Europe/Istanbul
  origin       TEXT NOT NULL,     -- IATA airport code: SAW
  destination  TEXT NOT NULL,     -- LHR
  depart_date  TEXT NOT NULL,     -- departure day
  stay_nights  INTEGER NOT NULL,  -- 0 = one way
  adults       INTEGER NOT NULL,
  cabin        TEXT NOT NULL,     -- economy
  currency     TEXT NOT NULL,     -- ISO 4217: EUR
  market       TEXT NOT NULL,     -- point of sale: TR
  source       TEXT NOT NULL,     -- API or site
  exit_country TEXT,              -- country of the exit IP
  fare_brand   TEXT,              -- fare brand: light (no bag)
  price_minor  INTEGER,           -- smallest unit (cents); NULL if no offer
  status       TEXT NOT NULL,     -- ok, no_offer, error, http_429
  UNIQUE (query_date, origin, destination, depart_date,
          stay_nights, adults, cabin, currency, market, source)
);

Three fields pay off most later. status separates a cell with no offer from a cell that failed. An empty cell can mean two different things, and they do not read the same. price_minor stores the price as an integer and avoids decimal rounding. The UNIQUE constraint stops the daily job from running twice by accident. If you take a second measurement as a noise check, write it with a different source label.

Reading the matrix

To read the matrix, first filter by the constants, then sort the table by query day and departure day:

python
import sqlite3
from collections import defaultdict

db = sqlite3.connect("fares.db")
rows = db.execute("""
  SELECT query_date, depart_date, price_minor, status
  FROM fare_obs
  WHERE origin = 'SAW' AND destination = 'LHR'
    AND stay_nights = 0 AND adults = 1 AND cabin = 'economy'
    AND currency = 'EUR' AND market = 'TR' AND fare_brand = 'light'
  ORDER BY query_date, depart_date
""").fetchall()

matrix = defaultdict(dict)
for q, d, price, status in rows:
    matrix[q][d] = price / 100 if status == "ok" else status

departs = sorted({d for row in matrix.values() for d in row})
for q in sorted(matrix):
    print(q, [matrix[q].get(d, "-") for d in departs])

Rows are daily snapshots of the calendar. If certain weekdays look low in a row again and again, that is a pattern tied to the departure day. Do not decide from a single row. The pattern has to repeat across several rows.

To compare columns with each other, align them by days left to departure. Every cell with 30 days left then sits at the same point:

sql
SELECT CAST(julianday(depart_date) - julianday(query_date) AS INTEGER)
         AS lead_days,
       COUNT(*) AS n,
       MIN(price_minor) / 100.0 AS low,
       MAX(price_minor) / 100.0 AS high
FROM fare_obs
WHERE status = 'ok' AND origin = 'SAW' AND destination = 'LHR'
  AND stay_nights = 0 AND adults = 1 AND cabin = 'economy'
  AND currency = 'EUR' AND market = 'TR' AND fare_brand = 'light'
GROUP BY lead_days
ORDER BY lead_days;

Look at the n column. A range computed from few observations is not a trend. In a fresh measurement, short-lead rows are full and long-lead rows are sparse. Before you talk about a route's behavior, wait until at least a few columns have filled up to departure.

Troubleshooting

A sudden change in the matrix usually comes from the measurement, not the price. Run these checks first:

SymptomLikely causeCheck
A whole row shifted at onceMarket or currency changedexit_country, market, currency
One day's cells are emptyRate limit or errorhttp_429, error in status
Jump in a column, different fare brandCheapest brand closedfare_brand
One cell jumped, back the next dayCache or noiseMeasure the same cell a second time
Two rows one day, none the nextTime zone driftThe query_date calculation

The price in a calendar view can come from a cache. The detail page for the date you pick is a live query and can differ. If a cell looks suspicious, confirm that date once with a detailed query.

How we tested

We ran the code samples on 2026-12-03 on Windows 11 with Python 3.13.17 and SQLite 3.50.4. We filled the table with randomly generated test rows. We sent no queries to any airline or search site, so this post contains no prices. On Windows, zoneinfo could not find time zone data and worked once the tzdata package was installed. A record at 22:30 UTC fell on the next day in Istanbul time. A second record for the same cell hit the UNIQUE constraint.

The bottom line

Write down the constants first, measure once a day at the same hour and store each row with its parameters. Read the result from columns aligned by days left to departure, not from rows. Above all, lock the market, because a drifting market invalidates the whole matrix. For the setup behind the measurement, see our price monitoring page.

Sources

Frequently asked questions

Which day are flights cheapest?

There is no fixed day. The cheap day changes with the route, the season and the airline's sales position. Instead of a general rule, measure your own route: look at the rows of the matrix and check whether the same weekday comes out low across several rows. A pattern means something only when it repeats, not in a single row.

How often should I check the price?

Once a day, at the same hour. One cell in the matrix is one day, and a daily measurement fills it. More frequent queries add noise and load on the source without bringing new information. If you want to see intraday changes, measure a few cells separately for a short time and keep them out of the main table.

Should I track round trips or one way?

Track the ticket type you will buy. One way keeps the table two-dimensional and is the easiest to read. If you track round trips, fix the length of stay, for example 7 nights. The return date then derives from the departure and no third axis enters the table. Keep several lengths of stay in separate matrices, not in one table.

Do I need a proxy for price tracking?

Usually not if you use an official API, because the market and currency go in as parameters. If the source is a public page that picks its country version from the IP address, exiting from a fixed country helps, for example with a Residential Proxy set to one country. The goal is not speed but seeing the same market every day.

Why is the calendar price different at checkout?

The calendar view is often fed from a cache, while the checkout step is a live query. Seats may have sold or the cheapest fare brand may have closed in between. Baggage, seat selection and card fees also change the total. Confirm a suspicious cell with a detailed query and compare on the same fare brand.

How long should I keep measuring?

Until at least one flight date's column has filled up to departure. Before a column is complete, the question "what does the price do as departure nears" cannot be answered. Once several columns are complete, align them by days left to departure and compare. To see the effect of season, repeat the measurement at different times of the year. A pattern from one period is not a forecast for another.

Ask ChatGPTAsk Claude