Python dashboard for Amazon Buy Box trends using SellerMagnetAPI

Building a Python Dashboard for Amazon Buy Box Trends with SellerMagnetAPI

By John Smith | July 23, 2025

Building a Python Dashboard for Amazon Buy Box Trends with SellerMagnetAPI

In the dynamic world of Amazon marketplace, staying ahead requires more than just intuition. Businesses need robust data analytics to make informed decisions about competitive analysis, inventory management, and market research. This is where a custom dashboard can be a game-changer. In this post, we’ll explore how to build a Python dashboard to track Amazon Buy Box trends using the SellerMagnetAPI, empowering your business with actionable insights.

Why Track Amazon Buy Box Trends?

The Buy Box is a critical element for Amazon sellers, as it significantly impacts sales. Monitoring Buy Box trends allows you to:

  • Analyze Competitor Strategies: Identify which sellers are consistently winning the Buy Box and understand their pricing and fulfillment strategies.
  • Optimize Pricing: Adjust your pricing in real-time to maximize your chances of winning the Buy Box.
  • Improve Inventory Management: Ensure you have sufficient stock to meet demand and maintain Buy Box eligibility.
  • Identify Market Opportunities: Spot emerging trends and capitalize on new product opportunities.

Getting Started with SellerMagnetAPI

SellerMagnetAPI provides enterprise-grade Amazon data, enabling you to extract valuable insights with ease. Before we dive into building the dashboard, let’s set up the necessary tools and libraries.

Prerequisites

  • Python 3.6+
  • SellerMagnetAPI Key (available at Try Free)
  • Libraries: requests, pandas, plotly, streamlit

Installation

Install the required Python libraries using pip:

pip install requests pandas plotly streamlit

Fetching Amazon Product Statistics with SellerMagnetAPI

We’ll primarily use the Amazon Product Statistics endpoint to gather Buy Box data. This endpoint provides detailed statistics, including historical Buy Box prices, seller IDs, and fulfillment methods.

Example Request

Here’s how to retrieve product statistics for a specific ASIN using the Amazon Product Statistics endpoint:

curl --request GET \
     --url 'https://sellermagnet-api.com/amazon-product-statistics?asin=B08N5WRWNW&marketplaceId=A1PA6795UKMFR9&api_key=YOUR_API_KEY&graphs=true'

Python Code Example

Here’s a Python code snippet to fetch the data:

import requests
import pandas as pd

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

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

response = requests.get(url)
data = response.json()

if data['success']:
    print(data['data'])
else:
    print(data['errors'])

Response Example

The API response includes detailed information about the product, including Buy Box history and sales rank history. Here’s a snippet of the JSON response:

{
  "success": true,
  "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
        ]
      ]
    }
  }
}

Building the Dashboard with Streamlit

Streamlit is a powerful Python library that makes it easy to create interactive web applications. We’ll use it to build our Amazon Buy Box trends dashboard.

Dashboard Structure

Our dashboard will consist of the following components:

  • Product Selection: A dropdown menu to select the ASIN to analyze.
  • Buy Box Price Trend Chart: A line chart displaying the Buy Box price over time.
  • Buy Box Seller History: A table showing the history of sellers who have won the Buy Box.
  • Sales Rank Trend Chart: A line chart illustrating the sales rank trend over time.

Python Code Example

Here’s the code to create the Streamlit dashboard:

import streamlit as st
import requests
import pandas as pd
import plotly.express as px

API_KEY = 'YOUR_API_KEY'
MARKETPLACE_ID = 'A1PA6795UKMFR9'

# Function to fetch product statistics
def get_product_stats(asin):
    url = f'https://sellermagnet-api.com/amazon-product-statistics?asin={asin}&marketplaceId={MARKETPLACE_ID}&api_key={API_KEY}&graphs=true'
    response = requests.get(url)
    data = response.json()
    if data['success']:
        return data['data']
    else:
        st.error(f"Error fetching data for ASIN: {asin}")
        return None

# Function to create Buy Box price trend chart
def create_buy_box_price_chart(data):
    df = pd.DataFrame(data['stats']['buyBoxPriceHistory'], columns=['timestamp', 'price'])
    df['timestamp'] = pd.to_datetime(df['timestamp'])
    fig = px.line(df, x='timestamp', y='price', title='Buy Box Price Trend')
    return fig

# Function to create Buy Box seller history table
def create_buy_box_seller_table(data):
    seller_history = data['buyBoxSellerIdHistory']
    df = pd.DataFrame(seller_history, columns=['timestamp', 'seller_id'])
    df['timestamp'] = pd.to_datetime(df['timestamp'])
    return df

# Function to create sales rank trend chart
def create_sales_rank_chart(data):
    df = pd.DataFrame(data['stats']['salesRankHistory'], columns=['timestamp', 'rank'])
    df['timestamp'] = pd.to_datetime(df['timestamp'])
    fig = px.line(df, x='timestamp', y='rank', title='Sales Rank Trend')
    fig.update_yaxes(autorange="reversed")
    return fig

# Streamlit app
st.title('Amazon Buy Box Trends Dashboard')

asin_options = ['B08N5WRWNW', 'B0CLTBHXWQ', 'B0CL61F39H'] # Example ASINs
selected_asin = st.selectbox('Select ASIN', asin_options)

product_data = get_product_stats(selected_asin)

if product_data:
    # Buy Box Price Trend Chart
    st.header('Buy Box Price Trend')
    buy_box_price_fig = create_buy_box_price_chart(product_data)
    st.plotly_chart(buy_box_price_fig)

    # Buy Box Seller History Table
    st.header('Buy Box Seller History')
    seller_history_df = create_buy_box_seller_table(product_data)
    st.dataframe(seller_history_df)

    # Sales Rank Trend Chart
    st.header('Sales Rank Trend')
    sales_rank_fig = create_sales_rank_chart(product_data)
    st.plotly_chart(sales_rank_fig)
else:
    st.write("Waiting for ASIN to be selected")

Running the Dashboard

Save the code as dashboard.py and run it using Streamlit:

streamlit run dashboard.py

This will open the dashboard in your web browser, allowing you to select an ASIN and view the corresponding Buy Box trends.

Advanced Use Cases

Beyond the basic dashboard, you can leverage other SellerMagnetAPI endpoints to enhance your analysis.

1. Combining with Amazon Product Offers

Use the Amazon Product Offers endpoint to get real-time pricing and availability data from different sellers. This can help you identify pricing strategies that lead to winning the Buy Box.

# Example of fetching product offers
ASIN = 'B08N5WRWNW'
url = f'https://sellermagnet-api.com/amazon-product-offers?asin={ASIN}&marketplaceId={MARKETPLACE_ID}&api_key={API_KEY}'
response = requests.get(url)
data = response.json()

if data['success']:
    offers = data['data']['offers']
    print(offers)
else:
    print(data['errors'])

2. Integrating Amazon Seller Review Data

Incorporate Amazon Seller Review data to assess the reputation of Buy Box winners. This can provide insights into whether a seller’s high rating contributes to their Buy Box success.

# Example of fetching seller reviews
SELLER_ID = 'A1B2C3D4E5F6G7' # Replace with a valid seller ID
url = f'https://sellermagnet-api.com/amazon-seller-review?sellerId={SELLER_ID}&marketplaceId={MARKETPLACE_ID}&api_key={API_KEY}'
response = requests.get(url)
data = response.json()

if data['success']:
    reviews = data['data']['marketplace'][MARKETPLACE_ID]
    print(reviews)
else:
    print(data['errors'])

3. Utilizing Amazon Product Lookup for Detailed Insights

The Amazon Product Lookup endpoint provides comprehensive product details, including bestseller ranks and categories. This information can be valuable for understanding market positioning.

# Example of fetching product lookup data
ASIN = 'B08N5WRWNW'
url = f'https://sellermagnet-api.com/amazon-product-lookup?asin={ASIN}&marketplaceId={MARKETPLACE_ID}&api_key={API_KEY}'
response = requests.get(url)
data = response.json()

if data['success']:
    product_info = data['data']['productInfo']
    print(product_info)
else:
    print(data['errors'])

Conclusion

Building a Python dashboard for Amazon Buy Box trends using SellerMagnetAPI empowers businesses to make data-driven decisions, optimize pricing strategies, and gain a competitive edge in the Amazon marketplace. By leveraging the power of SellerMagnetAPI’s endpoints, you can unlock valuable insights that drive growth and profitability.

Ready to take your Amazon business to the next level? Try SellerMagnetAPI for free and start building your custom dashboard today!

Back to Blog