DEV Community

Aurelix Solutions
Aurelix Solutions

Posted on

Amazon price and Best Sellers Rank tracking by ASIN in Python

Sellers and product researchers ask the same two questions every morning: did the price move, and did the Best Sellers Rank move? Answering them by hand means opening each product page and copying numbers into a sheet.

This post reads a list of ASINs into Python with one compact row per product, keeps the previous check on every row, and then switches to a mode that returns only the products whose price or rank changed.

Disclosure: I'm Aurelix, and I built Amazon Price Tracker & BSR Tracker, the tool used here. It's a paid tool (prices below).

What each row holds

  • asin, marketplace (amazon.com, .ca, .co.uk or .de), url, title.
  • price, listPrice, currency, savingsPercent.
  • deal and dealBadge, hasCoupon and coupon: Amazon's own deal and coupon text.
  • availability and inStock.
  • rank and rankCategory, plus bestSellersRank: the rank in every category the page shows.
  • rating, reviewCount.
  • previous (the last check's price, stock and rank), history (the last 10 checks), changedFields, priceChange, rankChange.

One check

pip install apify-client
Enter fullscreen mode Exit fullscreen mode
import os

from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("aurelix/amazon-price-rank-tracker").call(
    run_input={"products": ["B005EPRFKO", "B01H1R0K68", "https://www.amazon.ca/dp/B07Z8G97PY"],
               "trackingName": "my-products"}
)
for p in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(p["asin"], p["price"], p["currency"], p["deal"], p["rank"], p["rankCategory"])
Enter fullscreen mode Exit fullscreen mode

Run it again with the same trackingName and every row also carries previous and a growing history, so a scheduled run builds a price and rank history per ASIN from your first check.

Only what changed

run_input = {
    "products": ["B005EPRFKO", "B01H1R0K68", "B07Z8G97PY"],
    "onlyChanges": True,
    "trackingName": "my-products",
}
Enter fullscreen mode Exit fullscreen mode

With onlyChanges on, a run returns only products whose price or Best Sellers Rank changed since the last check, with changedFields ("price", "rank"), priceChange, rankChange (places gained) and the previous values. Unchanged products are not returned and cost less. Save the input as a task in the Apify Console and schedule it daily; a Slack or webhook URL gets a short digest after each run.

Limits

  • amazon.com, amazon.ca, amazon.co.uk and amazon.de; UK and German pages are read over residential proxies, a paid opt-in.
  • Over datacenter proxies Amazon sometimes serves its compact page, which has no rank; that row keeps the last rank seen and says so (rankFromThisCheck false).
  • History starts with your first run; there is no older price history.

Cost

$1.50 per 1,000 products on Apify's free plan, down to $1.10 on paid plans, $0.60 per 1,000 for unchanged products in only-changed mode, plus a $0.005 start fee per run. Current prices are on the Store page; Apify's free plan includes $5 of credit a month.

Top comments (0)