Tutorial

How to Build a Cross-Platform Price Tracker

Learn how to build a price tracker that monitors products across Amazon and Walmart, alerting you when prices drop or arbitrage opportunities appear.

Price tracking across Amazon and Walmart requires monitoring the same products on both platforms and comparing prices over time. Manual checking is impractical at scale. This tutorial builds an automated tracker that queries both platforms via Scavio's API, compares prices, and alerts on drops or arbitrage opportunities. The same API key covers both platforms with a consistent response format.

Prerequisites

  • Python 3.8+ installed
  • requests library installed
  • A Scavio API key from scavio.dev
  • A list of products to track

Walkthrough

Step 1: Define your product catalog

List the products you want to track across both platforms.

Python
import os

API_KEY = os.environ['SCAVIO_API_KEY']
PRODUCTS = [
    'Sony WH-1000XM5',
    'Apple AirPods Pro 2',
    'Samsung Galaxy S26',
    'Nintendo Switch 2',
]

Step 2: Search both platforms for each product

Query Amazon and Walmart for each product and extract pricing data.

Python
import requests
H = {'x-api-key': API_KEY}

def get_prices(product: str) -> dict:
    result = {'product': product}
    for platform in ['amazon', 'walmart']:
        resp = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
            json={'platform': platform, 'query': product}, timeout=10)
        top = resp.json().get('organic', [{}])[0]
        result[platform] = {
            'title': top.get('title', ''),
            'price': top.get('price'),
            'url': top.get('link', ''),
            'rating': top.get('rating'),
        }
    return result

Step 3: Calculate price differentials

Compare prices across platforms and flag arbitrage opportunities.

Python
def analyze_prices(price_data: dict, min_margin: float = 0.10) -> dict:
    amazon_price = price_data.get('amazon', {}).get('price')
    walmart_price = price_data.get('walmart', {}).get('price')
    if amazon_price and walmart_price and amazon_price > 0 and walmart_price > 0:
        diff = abs(amazon_price - walmart_price)
        margin = diff / max(amazon_price, walmart_price)
        cheaper = 'amazon' if amazon_price < walmart_price else 'walmart'
        price_data['analysis'] = {
            'cheaper_on': cheaper,
            'price_diff': round(diff, 2),
            'margin': round(margin * 100, 1),
            'arbitrage': margin >= min_margin,
        }
    else:
        price_data['analysis'] = {'error': 'price data incomplete'}
    return price_data

Step 4: Run daily and save history

Execute the tracker daily and store results for trend analysis.

Python
import json, datetime

def daily_track():
    date = datetime.date.today().isoformat()
    results = []
    for product in PRODUCTS:
        data = get_prices(product)
        analyzed = analyze_prices(data)
        results.append(analyzed)
        if analyzed.get('analysis', {}).get('arbitrage'):
            a = analyzed['analysis']
            print(f'ARBITRAGE: {product} - ${a["price_diff"]} cheaper on {a["cheaper_on"]} ({a["margin"]}% margin)')
    with open(f'prices_{date}.json', 'w') as f:
        json.dump(results, f, indent=2)
    return results

daily_track()

Python Example

Python
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}

def compare_prices(product):
    prices = {}
    for p in ['amazon', 'walmart']:
        data = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
            json={'platform': p, 'query': product}, timeout=10).json()
        top = data.get('organic', [{}])[0]
        prices[p] = top.get('price')
    return prices

print(compare_prices('Sony WH-1000XM5'))

JavaScript Example

JavaScript
async function comparePrices(product) {
  const prices = {};
  for (const p of ['amazon', 'walmart']) {
    const data = await fetch('https://api.scavio.dev/api/v1/search', {
      method: 'POST', headers: {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'},
      body: JSON.stringify({platform: p, query: product})
    }).then(r => r.json());
    prices[p] = data.organic?.[0]?.price;
  }
  return prices;
}

Expected Output

JSON
A daily price tracker comparing Amazon and Walmart prices with arbitrage alerts.

Related Tutorials

    Frequently Asked Questions

    Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

    Python 3.8+ installed. requests library installed. A Scavio API key from scavio.dev. A list of products to track. A Scavio API key gives you 500 free credits per month.

    Yes. The free tier includes 500 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

    Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

    Start Building

    Learn how to build a price tracker that monitors products across Amazon and Walmart, alerting you when prices drop or arbitrage opportunities appear.