Mexico Stock API Quick Integration Guide: BMV Real-Time Quotes & Historical Data

  1. iTick
  2. Tutorial
Mexico Stock API Quick Integration Guide: BMV Real-Time Quotes & Historical Data - iTick
Mexico Stock API Quick Integration Guide: BMV Real-Time Quotes & Historical Data

Mexico, as Latin America’s second-largest economy, hosts the Bolsa Mexicana de Valores (BMV) — one of the region’s oldest stock exchanges. The BMV lists high-quality blue-chip names such as América Móvil (AMXB), Walmart de México (WALMEX), FEMSA, and Cemex (CEMEX), among others. As of 2026, the exchange features more than 140 listed companies with a total market capitalization exceeding USD 500 billion, spanning financials, telecommunications, consumer goods, mining, and other key sectors. For global quantitative traders, fintech developers, and cross-border investors, accessing Mexican equity market data holds significant strategic importance.

This guide, based on the official iTick API documentation, provides a fully executable introduction to integrating Mexican stock market data. As a professional global financial data provider, iTick fully supports the Mexican market (region=MX), delivering comprehensive real-time quotes, historical K-lines, and multi-level order book depth across all BMV-listed equities. Through this article, you will learn how to quickly retrieve real-time quotes, historical bars, and depth for major Mexican stocks — providing reliable, stable data support for quantitative strategies and financial applications.

Why Choose iTick for Mexican Equity Market Access?

  • Official Coverage: iTick officially supports the Mexican market (region=MX)
  • Comprehensive Scope: Covers all stocks listed on the Bolsa Mexicana de Valores (BMV), including IPC Index constituents
  • Multi-Protocol Access: REST API + low-latency WebSocket streaming (<50 ms)
  • Extensive History: Over 30 years of K-line data, from 1-minute to monthly bars
  • Free Tier Friendly: Unlimited calls for basic real-time quotes — ideal for individual developers

I. 5-Minute Fast Integration: Retrieve Real-Time Quotes

1. Register and Obtain API Key

Visit the iTick official website to register and obtain your dedicated API Token in under 30 seconds.

2. Install Dependencies

      pip install requests

    

3. Retrieve Real-Time Quote for América Móvil (AMXB)

América Móvil (ticker: AMXB) is one of Mexico’s largest companies by market capitalization.

      import requests

API_KEY = "your_token_here"
url = "https://api.itick.org/stock/quote"
params = {"region": "MX", "code": "AMXB"}  # Mexico region = MX
headers = {"token": API_KEY, "accept": "application/json"}

resp = requests.get(url, params=params, headers=headers).json()
if resp.get("code") == 0:
    data = resp["data"]
    print(f"📊 {data.get('n')} ({data.get('s')})")
    print(f"Last: {data.get('ld')} MXN")
    print(f"Change: {data.get('chp')}%")
    print(f"Volume: {data.get('v')}")
else:
    print("Error:", resp.get("msg"))

    

Example Output:

      América Móvil SAB de CV (AMXB)
Last: 16.85 MXN
Change: 0.72%
Volume: 12456700

    

That’s it — you have successfully retrieved real-time Mexican equity data.

II. Core Features Overview

2.1 Retrieve Order Book Depth

      def get_mexico_depth(symbol):
    """Retrieve real-time order book depth for Mexican stocks"""
    url = "https://api.itick.org/stock/depth"
    params = {"region": "MX", "code": symbol}
    headers = {"token": API_KEY, "accept": "application/json"}

    resp = requests.get(url, params=params, headers=headers).json()
    if resp.get("code") == 0:
        depth = resp.get("data", {})
        print(f"📊 {symbol} Order Book Depth")
        print(f"--- Ask Side ---")
        for ask in depth.get('a', [])[:5]:  # Top 5 ask levels
            print(f"Level {ask.get('po')}: {ask.get('p')} MXN | Size: {ask.get('v')}")
        print(f"--- Bid Side ---")
        for bid in depth.get('b', [])[:5]:  # Top 5 bid levels
            print(f"Level {bid.get('po')}: {bid.get('p')} MXN | Size: {bid.get('v')}")
    else:
        print("Error:", resp.get("msg"))

# Test depth for three major stocks
for code in ["AMXB", "WALMEX", "FEMSA"]:
    print(f"\n🔍 Retrieving depth for {code}:")
    get_mexico_depth(code)

    

Order book (depth) data shows current buy and sell limit orders — essential for liquidity analysis, support/resistance identification, and market microstructure studies. iTick delivers real-time multi-level depth for Mexican equities.

2.2 Retrieve Historical K-Lines (for Backtesting)

Supports multiple timeframes: 1-min (kType=1), 5-min (2), 15-min (3), 60-min (5), Daily (8), Weekly (9), Monthly (10).

      def get_kline(symbol, ktype=8, limit=100):
    params = {"region": "MX", "code": symbol, "kType": ktype, "limit": limit}
    resp = requests.get("https://api.itick.org/stock/kline", headers=headers, params=params).json()
    if resp.get("code") == 0:
        data = resp.get("data", [])
        print(f"Retrieved {len(data)} bars")
        for item in data[-3:]:
            print(f"Time:{item['t']} O:{item['o']} H:{item['h']} L:{item['l']} C:{item['c']} Vol:{item['v']}")
    else:
        print("Error:", resp.get("msg"))

# Retrieve daily bars for América Móvil
get_kline("AMXB", ktype=8, limit=10)

    

2.3 WebSocket Real-Time Streaming (Low Latency)

      import websocket
import json

def on_message(ws, message):
    data = json.loads(message)
    if "data" in data:
        md = data["data"]
        if md.get("type") == "quote":
            print(f"[{md['s']}] Last: {md['ld']} MXN | Chg: {md['chp']}%")

ws = websocket.WebSocketApp(
    "wss://api.itick.org/stock",
    header={"token": API_KEY},
    on_open=lambda ws: ws.send(json.dumps({
        "ac": "subscribe",
        "params": "AMXB$MX,WALMEX$MX",  # Mexican ticker format: code$MX
        "types": "quote"
    })),
    on_message=on_message
)
ws.run_forever()

    

After subscription, receive real-time quote updates with latency under 50 ms.

2.4 IPO Calendar (Capture New Listing Opportunities)

The Mexican IPO market remains active. Use the IPO endpoint to track upcoming and recent listings.

      def get_mexico_ipo(type="upcoming"):
    params = {"region": "MX", "type": type}  # upcoming or recent
    resp = requests.get("https://api.itick.org/stock/ipo", headers=headers, params=params).json()
    if resp.get("code") == 0:
        for item in resp.get("data", [])[:3]:
            print(f"Company: {item.get('cn')} Ticker: {item.get('sc')} Offer Price: {item.get('pr')} MXN Listing Date: {item.get('dt')}")
    else:
        print("Error:", resp.get("msg"))

get_mexico_ipo("upcoming")  # Retrieve upcoming Mexican IPOs

    

III. Mexico Market Quick Reference (Essential for Developers)

ItemDescription
Market Coderegion=MX (REST) or $MX (WebSocket)
Major StocksAMXB (América Móvil), WALMEX (Walmart de México), FEMSA, CEMEX (Cemex)
Trading HoursMexico City time 08:30–15:00 (corresponds to 22:30–05:00 Beijing time; adjust for DST)
CurrencyMexican Peso (MXN)

IV. Why iTick Is the Best Choice for Mexico Stock APIs

Use CaseCommon Free API LimitationsiTick Advantages
Quantitative BacktestingOnly 1–2 years of data30+ years of history, including intraday
Real-Time Trading15-minute delayWebSocket streaming <50 ms
IPO MonitoringNo IPO dataComplete IPO calendar endpoint
Application DevelopmentREST onlyREST + WebSocket dual protocol
Cost ControlHeavy restrictions on free tierUnlimited basic real-time calls in free plan

V. Summary: Start Your Mexico Quantitative Journey Today

Through this guide, you have learned to:

  • ✅ Retrieve real-time quotes and historical data via REST API
  • ✅ Subscribe to low-latency real-time feeds via WebSocket
  • ✅ Access IPO calendars and other key datasets
  • ✅ Master core parameters for the Mexican market

iTick delivers stable, comprehensive, and free Mexican equity data access — perfect for building quantitative strategies, financial apps, or academic research.

👉 Register now at the iTick official website and begin your Mexican market data journey!


Further Reading: