guides5 min read

How to Analyze MTG Market Trends with API Data

Learn how to use TCGAPIs sales history and pricing data to analyze Magic: The Gathering market trends, identify price spikes, and make data-driven decisions.

T

TCGAPIs Team

Why Market Data Matters for MTG

Magic: The Gathering has one of the most dynamic secondary markets in the trading card game industry. Card prices can spike overnight due to tournament results, ban list changes, new set releases, or format rotations. Whether you're a player, collector, investor, or shop owner, understanding these trends gives you a significant edge.

With TCGAPIs, you can access the raw data that powers these insights — real-time prices, historical sales, and live marketplace listings — and build your own analysis tools.

Understanding the Data Sources

TCGAPIs provides three key data points for market analysis:

Current Prices

The /prices/:productId endpoint returns current market data:

{
  "productId": 12345,
  "lowPrice": 2.50,
  "midPrice": 4.00,
  "highPrice": 8.00,
  "marketPrice": 3.75,
  "directLowPrice": 2.99
}

Sales History

The /sales-history endpoint provides actual completed sales:

{
  "orderDate": "2025-11-25T14:30:00Z",
  "condition": "Near Mint",
  "purchasePrice": 3.50,
  "quantity": 1
}

Live Listings

The /livelistings/:productId endpoint shows current marketplace availability — what sellers are offering right now and at what price.

Setting Up Your Analysis Pipeline

Need to set up your API key first? Follow our quick start guide.

Let's build a simple analysis tool that identifies trending MTG cards.

Step 1: Fetch MTG Expansions

const API_KEY = process.env.TCGAPIS_KEY;
const BASE = 'https://api.tcgapis.com/api/v1';
 
// Category ID 1 = Magic: The Gathering
async function getMtgExpansions() {
  const response = await fetch(`${BASE}/expansions/1`, {
    headers: { 'Authorization': `Bearer ${API_KEY}` }
  });
  return response.json();
}

Step 2: Get Cards from Recent Sets

Focus on recent sets where price movement is most active:

async function getCardsFromExpansion(groupId) {
  const response = await fetch(`${BASE}/cards/${groupId}`, {
    headers: { 'Authorization': `Bearer ${API_KEY}` }
  });
  return response.json();
}

Compare current prices against historical data to find movers:

async function analyzePriceTrend(productId) {
  const [currentPrices, salesHistory] = await Promise.all([
    fetch(`${BASE}/prices/${productId}`, {
      headers: { 'Authorization': `Bearer ${API_KEY}` }
    }).then(r => r.json()),
    fetch(`${BASE}/sales-history?productId=${productId}`, {
      headers: { 'Authorization': `Bearer ${API_KEY}` }
    }).then(r => r.json())
  ]);
 
  // Calculate average sale price over the last 7 days
  const oneWeekAgo = new Date();
  oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
 
  const recentSales = salesHistory.filter(
    sale => new Date(sale.orderDate) >= oneWeekAgo
  );
 
  const avgRecentPrice = recentSales.length > 0
    ? recentSales.reduce((sum, s) => sum + s.purchasePrice, 0) / recentSales.length
    : null;
 
  return {
    productId,
    currentMarketPrice: currentPrices.marketPrice,
    avgRecentSalePrice: avgRecentPrice,
    salesVolume: recentSales.length,
    priceChange: avgRecentPrice
      ? ((currentPrices.marketPrice - avgRecentPrice) / avgRecentPrice) * 100
      : null
  };
}

Identifying Price Spikes

Price spikes in MTG usually correlate with specific events:

Tournament Results

When a card puts up strong results at a major tournament, demand surges. Monitor cards that see:

  • Sudden sales volume increases — More sales than usual signals rising demand
  • Listing depletion — Fewer live listings mean supply is being bought up
  • Price gap widening — Difference between low and market price grows
function isSpikingCard(analysis) {
  return (
    analysis.priceChange > 20 && // Price up 20%+
    analysis.salesVolume > 10    // At least 10 sales this week
  );
}

Ban List Changes

When cards get banned in a format, alternatives spike. When cards get unbanned, they spike too. Track cards in related archetypes:

// Example: Monitor a watchlist of cards
const WATCHLIST = [
  { name: 'Card A', productId: 11111 },
  { name: 'Card B', productId: 22222 },
  { name: 'Card C', productId: 33333 },
];
 
async function checkWatchlist() {
  const results = await Promise.all(
    WATCHLIST.map(async (card) => {
      const trend = await analyzePriceTrend(card.productId);
      return { ...card, ...trend };
    })
  );
 
  const spiking = results.filter(isSpikingCard);
  if (spiking.length > 0) {
    console.log('Price spike detected:');
    spiking.forEach(card => {
      console.log(
        `  ${card.name}: +${card.priceChange.toFixed(1)}% ` +
        `($${card.currentMarketPrice})`
      );
    });
  }
}

Building a Market Dashboard

Here's a simple approach for a market dashboard:

Daily Price Snapshots

Store daily price snapshots to build your own historical dataset:

async function takeSnapshot(productIds) {
  const snapshots = await Promise.all(
    productIds.map(async (id) => {
      const prices = await fetch(`${BASE}/prices/${id}`, {
        headers: { 'Authorization': `Bearer ${API_KEY}` }
      }).then(r => r.json());
 
      return {
        productId: id,
        date: new Date().toISOString().split('T')[0],
        marketPrice: prices.marketPrice,
        lowPrice: prices.lowPrice,
        midPrice: prices.midPrice,
        highPrice: prices.highPrice,
      };
    })
  );
 
  // Save to your database
  return snapshots;
}

Supply Analysis with Live Listings

Track how many copies are available on the market:

async function analyzeSupply(productId) {
  const listings = await fetch(
    `${BASE}/livelistings/${productId}`,
    { headers: { 'Authorization': `Bearer ${API_KEY}` } }
  ).then(r => r.json());
 
  const totalQuantity = listings.reduce(
    (sum, l) => sum + l.quantity, 0
  );
  const lowestPrice = Math.min(
    ...listings.map(l => l.price)
  );
  const uniqueSellers = new Set(
    listings.map(l => l.sellerName)
  ).size;
 
  return {
    totalCopiesAvailable: totalQuantity,
    lowestListingPrice: lowestPrice,
    numberOfSellers: uniqueSellers,
  };
}

Practical Use Cases

For Players

  • Track staple cards before a tournament to buy at the right time
  • Monitor rotation targets before a new standard season
  • Find underpriced cards that are seeing tournament play

For Collectors

  • Identify cards trending upward before they spike
  • Track the value of your collection over time
  • Find deals by comparing market price to lowest listing

For Shop Owners

Card shop owners can also automate their inventory management using similar API endpoints.

  • Adjust pricing based on real-time market movement
  • Identify high-demand cards to stock up on
  • Avoid holding cards that are trending downward

For Content Creators

  • Provide data-backed market reports
  • Create "cards to watch" content with real metrics
  • Analyze set value and expected value of sealed products

Getting Started

See why developers prefer TCGAPIs in our TCG API comparison guide.

The Hobby tier gives you 10,000 API requests per month — enough to monitor dozens of cards daily with room to spare.

For production dashboards that track hundreds or thousands of cards, the Business or Unlimited plans give you the headroom you need. Sign up and access your dashboard to get started.

MTGmarket analysissales historyMagic The GatheringMTG price API