Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

You can track Amazon prices with Python by collecting timestamped price histories for a fixed set of products, saving the raw observations, and comparing the same basket over time. The result is a custom Amazon product-basket index—not a measure of economy-wide inflation and not an official Consumer Price Index (CPI).

For a quick check of one item, Amazon’s price-history feature may be enough. For a dataset you can export, clean, and calculate against a consistent basket, Keepa’s API and its community-developed Python client offer a programmable route.

How can I track Amazon prices with Python?

Use a historical price source, define a stable basket, and save every observation with enough context to make later comparisons meaningful. Keepa’s API documents historical product data for Amazon marketplaces; its Python client provides a way to query products and work with timestamped price-history arrays. Keepa describes its API as delivering “price histories of products and offers from international Amazon marketplaces right to your application.” Keepa API documentation

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Python package is community-developed, not an official Keepa client. Its documentation shows installation with pip install keepa and product queries with history enabled. Keepa Python client documentation

1. Define the basket before collecting data

Choose a small set of products that you can identify and compare consistently. Record each product’s ASIN, Amazon marketplace or locale, currency, and the exact price basis you intend to follow. A name alone is not a reliable identifier: listings can change, and two similar products may differ in size, condition, or included accessories.

  • Use the same ASIN and marketplace for each product throughout the comparison.
  • Choose which price field to track, such as the product’s displayed price or an offer price, and keep that choice consistent.
  • Decide whether shipping, taxes, coupons, and item condition are included. Do not combine observations with different price bases as if they were equivalent.
  • Set a collection cadence that you can maintain, and record the observation timestamp rather than assuming the API’s history timestamps match your own collection schedule.

If a product is replaced, its package size changes, or the relevant seller or condition changes, flag that break in the series. A lower price for a smaller package, for example, does not necessarily mean the same thing became cheaper.

2. Install the client and query a product

Install the documented package in your Python environment:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
pip install keepa

Keepa’s documentation demonstrates querying an ASIN with history enabled. The following is a structural example; replace the environment variable and ASIN with your own values and consult the client documentation for the exact return structure and available parameters:

import os
import keepa

api = keepa.Keepa(os.environ["KEEPA_API_KEY"])
products = api.query("ASIN_HERE", history=True)
product = products[0]

# Inspect the product's fields and history arrays before selecting
# the specific price series you intend to store.
print(product.keys())

Keep the API key in an environment variable or another secrets manager, not in a notebook or script committed to source control. The Keepa API uses a token bucket. Keepa currently documents one token per requested product for a basic product request; optional offer retrieval costs more. Check the API response’s token fields, including tokensLeft, and the documented request costs before choosing how often to query. Keepa API documentation

The Python client documentation also shows optional query settings such as stats=90; this is an example parameter, not a requirement for tracking. Decide whether to retrieve historical arrays or a particular summary only after checking what each field represents and whether it matches your chosen price basis. Keepa Python client documentation

3. Preserve raw observations

Write each observation to a CSV file or database before calculating totals or percentage changes. Keep the original nominal price and its context so you can recalculate later if your basket definition changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A useful record includes:

  • ASIN and a human-readable product label;
  • marketplace or locale and currency;
  • observation timestamp and source-history timestamp, if both are available;
  • the exact price field and value;
  • whether shipping, tax, coupons, and condition are reflected;
  • any note that could affect comparability, such as a listing or package change.

When cleaning history arrays with pandas or NumPy, retain enough information to distinguish missing data from a genuine price value. Do not silently fill a missing observation with zero or treat a product that has no recorded price as unchanged.

4. Calculate a clearly labeled basket index

For a simple unweighted basket, sum the prices of the same products in a base period and in a later period. Calculate:

custom_index = (current_basket_total / base_period_basket_total) * 100

If the base-period total is 100, an index value of 108 means the tracked basket costs 8% more under your chosen price definitions and observations. It does not mean prices across the economy rose 8%. State the products included, the base period, the price basis, and how you handled missing observations. If you use weights, disclose them and apply them consistently.

Use pandas or NumPy to align observations by period and calculate totals; use Matplotlib to plot the resulting series if a chart helps. A plot should identify the marketplace, currency, basket, time range, and index base so readers do not mistake the custom measure for an official statistic.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What can this tracker tell you—and what can’t it?

A fixed Amazon basket can show how the selected products’ recorded prices changed under a defined collection method. It can help answer a question such as whether the products you regularly monitor cost more now than in your chosen base period.

It does not automatically measure “real-world inflation.” An Amazon product basket is limited to selected listings and marketplace prices; it may not represent household spending, products sold elsewhere, or the changing mix and quality of goods that official price indexes are designed to address. A product’s coupon, shipping charge, tax treatment, seller, condition, or package size can also shift the observed price without a like-for-like change in the item itself.

Collection cadence matters too. A web-collected series and a traditionally collected price series may observe prices at different frequencies. The IMF CPI Manual search-result excerpt notes that frequency differences should be accounted for when combining web-scraped and traditional price collection, and that ignoring them can underestimate inflation. That is a narrow methodological caution, not a complete account of CPI construction. IMF Consumer Price Index Manual

If comparing your index with CPI, align the time periods and explain the difference in basket scope and collection methods. Do not present the custom tracker as CPI or use it to claim an official inflation rate.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Should you use Keepa or Amazon’s price-history feature?

Use a Python workflow when you need to collect, store, and calculate observations for multiple products under your own basket definition. Use Amazon’s built-in feature when you want a quick history view for an individual item without building a dataset.

Approach Best fit Access and scope
Keepa API with Python Exportable historical observations and a custom product-basket calculation Requires an API key; requests use token accounting, and costs vary with the request
Amazon price history A consumer-facing check of an individual product’s recent history Amazon’s page describes 30-, 90-, and 365-day views; feature availability and rollout can vary

Amazon’s price-history page lists availability in the US, UK, Canada, and India. Its statement about the 365-day rollout specifically names the US, UK, and India, so do not assume identical access in every listed country or account. Check Amazon’s current page and the product interface for availability. The page uses shopper questions such as “What’s the price history?”, “Has this item been on sale in the past 30 days?” and “Is this the lowest price recently?” Amazon price history

Amazon Staff reported in 2026 that more than 50 million customers had checked price history since the feature launched in 2024. This is an Amazon-published usage figure, not an independently verified measure. Amazon Staff

Why not use Amazon’s Product Pricing API?

Amazon’s Product Pricing API is documented as a tool for pricing and offer information in Amazon’s catalog, designed for automated seller price management. Amazon marks it “Sellers only” and lists its current version as v2022-05-01. It is not a general consumer API that this shopper-focused tutorial can assume you can access. Amazon Product Pricing API use-case guide

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common causes of misleading results

  • Changing product identity: a replacement ASIN or materially different package is not automatically a continuous series.
  • Mixing price definitions: taxes, shipping, coupons, seller, and item condition can make two recorded prices incomparable.
  • Inconsistent timing: observations collected at different frequencies may miss short-lived discounts or other price changes.
  • Unexplained missing values: excluding a product in one period changes the basket total; treating it as zero creates an artificial drop.
  • Overstating the result: a custom index describes only its stated basket and method, not the entire economy or official CPI.

Keep the collection rules stable, preserve the raw records, and document any break in the basket. That makes the resulting series auditable and easier to interpret.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.