Python Dashboard for Amazon Bestseller Insights

Building a Python Dashboard for Amazon Bestseller Insights

By Emma Johnson | July 10, 2025

Building a Python Dashboard for Amazon Bestseller Insights with SellerMagnet

For Amazon businesses and market analysts, staying ahead of the curve requires real-time insights into product performance, competitor strategies, and market trends. Building a Python dashboard integrated with an Amazon data API like SellerMagnet provides a powerful solution for competitive analysis, inventory management, and market research. This article demonstrates how to create such a dashboard, leveraging SellerMagnet's enterprise-grade data to drive informed business decisions.

Why Build a Custom Amazon Insights Dashboard?

Off-the-shelf solutions often lack the flexibility and customization needed to address specific business requirements. A custom dashboard allows you to:

  • Tailor Data Views: Focus on the metrics that matter most to your business.
  • Integrate with Existing Systems: Seamlessly connect Amazon data with your internal databases and workflows.
  • Automate Reporting: Generate regular reports and alerts based on predefined criteria.
  • Gain Competitive Advantage: Monitor competitor activities and identify emerging market opportunities.

Leveraging SellerMagnet's Amazon Data API

SellerMagnet offers a comprehensive Structured Data API that provides access to a wealth of Amazon product data. Here's how you can use it to build your dashboard:

1. Setting Up Your Python Environment

First, ensure you have Python installed. Then, install the necessary libraries:


pip install requests pandas matplotlib

2. Retrieving Product Statistics

The Amazon Product Statistics endpoint provides detailed data on a specific product, including sales rank and review counts. Here’s a Python example:


import requests
import pandas as pd
import matplotlib.pyplot as plt

API_KEY = 'YOUR_API_KEY'
ASIN = 'B08N5WRWNW'
MARKETPLACE_ID = 'A1PA6795UKMFR9'

url = f'https://sellermagnet-api.com/amazon-product-statistics?api_key={API_KEY}&asin={ASIN}&marketplaceId={MARKETPLACE_ID}&graphs=true'

response = requests.get(url)
response.raise_for_status()  # Raise HTTPError for bad responses (4xx or 5xx)

data = response.json()

if data['success']:
    product_data = data['data']
    print(product_data)
else:
    print(f"Error: {data['errors']}")

Here's an example response:


{
  "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
}

3. Visualizing Sales Rank History

Use the `salesRankHistory` data to create a line chart showing the product's sales rank over time:


if data['success']:
    product_data = data['data']
    sales_rank_history = product_data['stats']['salesRankHistory']
    
    # Convert data to Pandas DataFrame for easier handling
    df = pd.DataFrame(sales_rank_history, columns=['timestamp', 'sales_rank'])
    df['timestamp'] = pd.to_datetime(df['timestamp'])
    df['sales_rank'] = df['sales_rank'].astype(int)

    # Create the plot
    plt.figure(figsize=(12, 6))
    plt.plot(df['timestamp'], df['sales_rank'], marker='o', linestyle='-')
    plt.title(f'Sales Rank History for ASIN: {ASIN}')
    plt.xlabel('Time')
    plt.ylabel('Sales Rank')
    plt.gca().invert_yaxis()  # Invert y-axis to show better ranks at the top
    plt.grid(True)
    plt.tight_layout()

    # Save the plot to a file
    plt.savefig('sales_rank_history.png')
    plt.close()

    print("Sales rank history plot saved to sales_rank_history.png")
else:
    print(f"Error: {data['errors']}")

4. Building a Basic Dashboard

For simplicity, let's create a basic dashboard using HTML and Flask (a Python web framework). First, install Flask:


pip install flask

Then, create a `dashboard.py` file:


from flask import Flask, render_template
import requests
import pandas as pd
import matplotlib.pyplot as plt
import io
import base64

app = Flask(__name__)

API_KEY = 'YOUR_API_KEY'
ASIN = 'B08N5WRWNW'
MARKETPLACE_ID = 'A1PA6795UKMFR9'

@app.route('/')
def dashboard():
    url = f'https://sellermagnet-api.com/amazon-product-statistics?api_key={API_KEY}&asin={ASIN}&marketplaceId={MARKETPLACE_ID}'
    response = requests.get(url)
    response.raise_for_status()
    data = response.json()

    if data['success']:
        product_data = data['data']
        sales_rank_history = product_data['stats']['salesRankHistory']

        # Data preparation for sales rank history
        df = pd.DataFrame(sales_rank_history, columns=['timestamp', 'sales_rank'])
        df['timestamp'] = pd.to_datetime(df['timestamp'])
        df['sales_rank'] = df['sales_rank'].astype(int)

        # Create the plot
        plt.figure(figsize=(12, 6))
        plt.plot(df['timestamp'], df['sales_rank'], marker='o', linestyle='-')
        plt.title(f'Sales Rank History for ASIN: {ASIN}')
        plt.xlabel('Time')
        plt.ylabel('Sales Rank')
        plt.gca().invert_yaxis()
        plt.grid(True)
        plt.tight_layout()

        # Convert plot to PNG image
        img = io.BytesIO()
        plt.savefig(img, format='png')
        img.seek(0)
        plot_url = base64.b64encode(img.read()).decode('utf-8')

        plt.close()

        return render_template('dashboard.html', plot_url=plot_url, product_data=product_data)
    else:
        return f"Error: {data['errors']}"

if __name__ == '__main__':
    app.run(debug=True)

Create a `templates` folder and add `dashboard.html`:





    Amazon Product Dashboard


    

Amazon Product Dashboard

ASIN: {{ product_data['asin'] }}

Sales Rank History

Run the Flask app:


python dashboard.py

Visit `http://127.0.0.1:5000/` in your browser to see the basic dashboard.

Advanced Dashboard Features

Expand your dashboard with additional features using SellerMagnet's other API endpoints:

Example: Displaying Product Offers

Modify `dashboard.py` to include product offers:


@app.route('/')
def dashboard():
    # ... (previous code)
    offers_url = f'https://sellermagnet-api.com/amazon-product-offers?api_key={API_KEY}&asin={ASIN}&marketplaceId={MARKETPLACE_ID}'
    offers_response = requests.get(offers_url)
    offers_response.raise_for_status()
    offers_data = offers_response.json()

    if offers_data['success']:
        offers = offers_data['data']['offers']
        return render_template('dashboard.html', plot_url=plot_url, product_data=product_data, offers=offers)
    else:
        return f"Error fetching offers: {offers_data['errors']}"

Update `dashboard.html` to display the offers:


Product Offers

    {% for offer in offers %}
  • Seller: {{ offer['sellerName'] }} - Price: {{ offer['totalPrice'] }} {{ offers_data['data']['currency']['symbol'] }} - Condition: {{ offer['condition'] }}
  • {% endfor %}

5. Automating Data Updates with DataPipeline

To keep your dashboard current, schedule regular data updates using a task scheduler or SellerMagnet’s DataPipeline. This ensures you always have access to the latest insights without manual intervention.

Conclusion

Building a Python dashboard with SellerMagnet empowers Amazon businesses to gain a competitive edge through data-driven decision-making. By leveraging SellerMagnet's robust API, you can create a customized solution tailored to your specific needs, enabling you to monitor product performance, track competitor strategies, and identify emerging market opportunities. For more advanced features, consider exploring Amazon Web Scraping options and Geolocation to refine product availability and deliverability.

Back to Blog