Building a Python Tool for Amazon Product Price History Analysis
For Amazon businesses and market analysts, understanding product price history is crucial for competitive analysis, inventory management, and making informed market research decisions. This post guides you through building a Python tool leveraging SellerMagnet’s robust Amazon data API to track and analyze product price fluctuations.
Why Price History Analysis Matters
- Competitive Pricing: Monitor competitor pricing strategies.
- Inventory Management: Optimize buying decisions based on historical price trends.
- Market Research: Identify seasonal trends and market dynamics.
Introducing SellerMagnet’s Amazon Product Statistics API
SellerMagnet offers an enterprise-grade Amazon Product Statistics API, providing detailed historical data for Amazon products. This includes price, sales rank, and review count, enabling comprehensive analysis.
Setting Up Your Python Environment
First, ensure you have Python installed. Then, install the `requests` library to make HTTP requests:
pip install requests
Fetching Product Price History with Python
Use the following Python code to retrieve product statistics using SellerMagnet’s API:
import requests
import json
api_key = "YOUR_API_KEY" # Replace with your SellerMagnet API key
asin = "B08N5WRWNW" # Example ASIN
marketplace_id = "A1PA6795UKMFR9" # Example Marketplace ID (Germany)
url = f"https://sellermagnet-api.com/amazon-product-statistics?asin={asin}&marketplaceId={marketplace_id}&api_key={api_key}&graphs=true"
try:
response = requests.get(url)
response.raise_for_status() # Raise an exception for HTTP errors
data = response.json()
print(json.dumps(data, indent=4))
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
if data['success']:
# Extracting price history
price_history = data['data']['stats']['buyBoxPriceHistory']
print("\nPrice History:\")
for date, price in price_history:
print(f"Date: {date}, Price: {price / 100:.2f} {data['data']['currency']['code']}")
# Extracting graphs url
print("\nGraphs URL:\")
print(data['data']['graphs']['amazonAsSellerPriceHistory'])
else:
print("Error fetching data.")
Replace `YOUR_API_KEY`, `B08N5WRWNW`, and `A1PA6795UKMFR9` with your actual API key, the product's ASIN, and the appropriate marketplace ID.
Response example:
{
"data": {
"asin": "B0CLTBHXWQ",
"productTitle": "Playstation 5 Console Edizione Digital Slim",
"buyBoxPrice": 41800,
"buyBoxFulfillment": "FBM",
"buyBoxSellerIdHistory": [
[
"2025-06-14 17:08:00",
"A2I59UVTUWUFH0"
]
],
"categoryTree": [
{
"catId": 412603031,
"name": "Videogiochi"
},
{
"catId": 20904349031,
"name": "PlayStation 5"
},
{
"catId": 20904364031,
"name": "Console"
}
],
"graphs": {
"amazonAsSellerPriceHistory": "https://sellermagnet-api-webspace.s3.eu-central-1.amazonaws.com/amazon/api/charts/B0CLTBHXWQ/1749913774/B0CLTBHXWQ_amazon_price_1749913773.png",
"lowestFBAPriceHistory": "https://sellermagnet-api-webspace.s3.eu-central-1.amazonaws.com/amazon/api/charts/B0CLTBHXWQ/1749913776/B0CLTBHXWQ_fba_price_1749913773.png",
"lowestFBMPriceHistory": "https://sellermagnet-api-webspace.s3.eu-central-1.amazonaws.com/amazon/api/charts/B0CLTBHXWQ/1749913775/B0CLTBHXWQ_fbm_price_1749913773.png",
"monthlySoldHistory": "https://sellermagnet-api-webspace.s3.eu-central-1.amazonaws.com/amazon/api/charts/B0CLTBHXWQ/1749913778/B0CLTBHXWQ_monthly_sold_1749913773.png",
"productRatingHistory": "https://sellermagnet-api-webspace.s3.eu-central-1.amazonaws.com/amazon/api/charts/B0CLTBHXWQ/1749913777/B0CLTBHXWQ_rating_1749913773.png"
},
"listedSince": "2023-12-30 01:00:00",
"lowestFBAPrice": 44999,
"lowestFBMPrice": 41700,
"marketplaceId": "APJ6JRA9NG5V4",
"marketplaceNewPriceHistory": [
[
"2025-06-14",
41700
]
],
"offers": {
"A11IL2PNWYJU7H": {
"isFBA": true,
"lastUpdated": "2025-06-14 17:08:00",
"priceHistory": [
[
"2025-06-14 06:22:00",
44999,
0
]
],
"stockHistory": [
[
"2025-05-29 11:32:00",
1
]
]
},
"A12FLY25DT7QO0": {
"isFBA": false,
"lastUpdated": "2025-06-14 17:08:00",
"priceHistory": [
[
"2025-06-09 15:32:00",
41800,
0
]
],
"stockHistory": [
[
"2025-06-14 13:34:00",
49
]
]
},
"A18KSDUE00UP6J": {
"isFBA": false,
"lastUpdated": "2025-06-14 17:08:00",
"priceHistory": [
[
"2025-05-29 11:32:00",
42890,
0
]
],
"stockHistory": [
[
"2025-05-30 18:30:00",
3
]
]
}
},
"productReviewAverage": 4.7,
"productTotalReviews": 3129,
"rootCategory": {
"id": 412603031,
"name": "Videogiochi"
},
"stats": {
"amazonAsSellerPriceHistory": [
[
"2025-06-14",
44999
]
],
"buyBoxPriceHistory": [
[
"2025-06-13",
41700
]
],
"monthlySoldHistory": [
[
"2025-06",
1000
]
],
"productRatingCountHistory": [
[
"2025-06-14 15:28:00",
3129
]
],
"productRatingHistory": [
[
"2025-02-02 01:30:00",
4.7
]
],
"salesRankHistory": [
[
"2025-06-14 01:58:00",
15
]
]
}
},
"success": true
}
Analyzing the Data
The API response contains valuable data, including:
- buyBoxPriceHistory: A chronological record of the Buy Box price.
- salesRankHistory: Historical sales rank data.
- graphs: Links to graphs for visualizing price and sales rank trends.
Advanced Use Cases
1. Automated Price Drop Alerts
Implement a script that periodically checks the price and sends an alert when it drops below a certain threshold. Consider using DataPipeline to create an automated schedueler.
2. Competitor Monitoring
Track the price history of multiple products from your competitors to adjust your pricing strategy accordingly.
3. Visualizing Price Trends
Use libraries like `matplotlib` or `seaborn` to create custom visualizations of the price history data.
Leveraging Other SellerMagnet APIs
Enhance your analysis with other SellerMagnet APIs:
- Amazon Product Lookup: Get comprehensive product details.
- Amazon Product Offers: List current offers, including price, seller, and inventory.
- Amazon Seller Review: Check Seller Reviews and Rating.
- Amazon Product Estimate Sales: Retrieve Estimated Sales Data.
Legal Compliance and Ethical Considerations
Ensure your data collection and analysis practices are compliant with Amazon's terms of service and relevant data protection regulations. Avoid scraping product pages directly; always use the official API.
Conclusion
By leveraging SellerMagnet’s Amazon Product Statistics API, you can build a powerful Python tool for in-depth price history analysis. This enables data-driven decision-making, providing a competitive edge in the Amazon marketplace. Start your free trial today and unlock the power of Amazon data!
For more information, refer to our Documentation or explore our Code Examples.