Resumen
Walmart sellers y arbitrage buyers necesita to rastrear price movements y disponibilidad cambios on el second-largest US e-commerce plataforma. Este flujo de trabajo searches Walmart diario for tracked productos, compara contra linea base prices, y envia alertas for significativo caidas de precio, out-of-stock eventos, y nuevo competidor listings. Catch Walmart cambios de precio dentro de horas instead of dias.
Desencadenador
Diario at 8 AM via cron.
Programación
Diario 8 AM
Pasos del flujo de trabajo
Cargar Producto Watchlist
Leer el lista of Walmart productos to monitorear: names, objetivo prices, y linea base datos.
Search Walmart for Cada Producto
Call Scavio con walmart plataforma for cada producto. Extraer actual price, disponibilidad, y seller info.
Comparar Against Baseline
Verificar if price dropped below objetivo, if stock changed, o if nuevo sellers appeared.
Enviar Price Drop Alerts
For productos con significativo cambios, enviar un Slack o correo electronico alerta con el detalles.
Actualizar Baseline
Save actual prices y disponibilidad as el nuevo linea base for tomorrow's comparacion.
Implementacion en Python
import requests, os, json
from pathlib import Path
from datetime import date
API_KEY = os.environ["SCAVIO_API_KEY"]
H = {"x-api-key": API_KEY, "Content-Type": "application/json"}
WATCHLIST = [
{"name": "Dyson V15 Detect", "target_price": 550},
{"name": "Apple AirPods Pro 2", "target_price": 180},
{"name": "Samsung 65 inch OLED TV", "target_price": 1200},
]
BASELINE_FILE = Path("walmart_baseline.json")
def search_walmart(product: str) -> dict:
resp = requests.post(
"https://api.scavio.dev/api/v1/search",
headers=H,
json={"query": product, "platform": "walmart"},
timeout=15,
)
results = resp.json().get("organic_results", [])
if results:
top = results[0]
return {"title": top.get("title", ""), "price": top.get("price"), "rating": top.get("rating"), "in_stock": top.get("in_stock", True), "url": top.get("link", "")}
return {}
def monitor_walmart():
baseline = json.loads(BASELINE_FILE.read_text()) if BASELINE_FILE.exists() else {}
alerts = []
new_baseline = {}
for item in WATCHLIST:
result = search_walmart(item["name"])
if not result:
continue
key = item["name"]
new_baseline[key] = result
prev = baseline.get(key, {})
if result.get("price") and result["price"] <= item["target_price"]:
alerts.append({"type": "PRICE_TARGET", "product": item["name"], "price": result["price"], "target": item["target_price"]})
if prev.get("price") and result.get("price"):
change = (result["price"] - prev["price"]) / prev["price"]
if change <= -0.05:
alerts.append({"type": "PRICE_DROP", "product": item["name"], "old": prev["price"], "new": result["price"], "change": f"{change:.1%}"})
if prev.get("in_stock") and not result.get("in_stock"):
alerts.append({"type": "OUT_OF_STOCK", "product": item["name"]})
BASELINE_FILE.write_text(json.dumps(new_baseline, indent=2))
return alerts
alerts = monitor_walmart()
print(f"Walmart monitoring: {len(alerts)} alerts")
for a in alerts:
print(f" [{a['type']}] {a['product']}: {json.dumps({k:v for k,v in a.items() if k not in ['type','product']})}")Implementacion en JavaScript
const H = {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'};
const fs = await import('fs');
const WATCHLIST = [
{name:'Dyson V15 Detect', targetPrice:550},
{name:'Apple AirPods Pro 2', targetPrice:180},
{name:'Samsung 65 inch OLED TV', targetPrice:1200},
];
async function searchWalmart(product) {
const r = await fetch('https://api.scavio.dev/api/v1/search', {method:'POST', headers:H, body:JSON.stringify({query:product, platform:'walmart'})});
const results = (await r.json()).organic_results || [];
if (results.length) {
const top = results[0];
return {title:top.title||'', price:top.price, rating:top.rating, inStock:top.in_stock!==false, url:top.link||''};
}
return null;
}
async function monitorWalmart() {
let baseline = {};
try { baseline = JSON.parse(fs.readFileSync('walmart_baseline.json','utf8')); } catch {}
const alerts = [];
const newBaseline = {};
for (const item of WATCHLIST) {
const result = await searchWalmart(item.name);
if (!result) continue;
newBaseline[item.name] = result;
const prev = baseline[item.name] || {};
if (result.price && result.price <= item.targetPrice) alerts.push({type:'PRICE_TARGET', product:item.name, price:result.price, target:item.targetPrice});
if (prev.price && result.price) {
const change = (result.price - prev.price) / prev.price;
if (change <= -0.05) alerts.push({type:'PRICE_DROP', product:item.name, old:prev.price, new:result.price, change:(change*100).toFixed(1)+'%'});
}
if (prev.inStock && !result.inStock) alerts.push({type:'OUT_OF_STOCK', product:item.name});
}
fs.writeFileSync('walmart_baseline.json', JSON.stringify(newBaseline, null, 2));
return alerts;
}
const alerts = await monitorWalmart();
console.log('Walmart monitoring: '+alerts.length+' alerts');
for (const a of alerts) console.log(' ['+a.type+'] '+a.product);Plataformas utilizadas
Walmart
Búsqueda de productos con precios y datos de cumplimiento