Get Prices
Retrieve real-time prices and historical price data for markets.
Real-Time Prices
Endpoint
GET https://api.matchr.xyz/v1/prices
Query Parameters
Comma-separated list of market IDs (max: 50)
Include top-of-book bid/ask
Example Request
curl -X GET "https://api.matchr.xyz/v1/prices?market_ids=mkt_yes123,mkt_no123&include_orderbook=true" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"success": true,
"data": {
"mkt_yes123": {
"price": 0.52,
"best_bid": 0.51,
"best_ask": 0.53,
"spread": 0.02,
"change_24h": 0.03,
"change_pct_24h": 6.12,
"volume_24h": 250000,
"last_trade": "2024-10-15T14:28:45Z",
"updated_at": "2024-10-15T14:30:00Z"
},
"mkt_no123": {
"price": 0.48,
"best_bid": 0.47,
"best_ask": 0.49,
"spread": 0.02,
"change_24h": -0.03,
"change_pct_24h": -5.88,
"volume_24h": 200000,
"last_trade": "2024-10-15T14:27:30Z",
"updated_at": "2024-10-15T14:30:00Z"
}
},
"timestamp": "2024-10-15T14:30:00Z"
}
Historical Prices
Endpoint
GET https://api.matchr.xyz/v1/prices/history
Query Parameters
Market ID to fetch history for
Time interval: 1m, 5m, 15m, 1h, 4h, 1d, 1w
Start time (ISO 8601 or Unix timestamp)
End time (ISO 8601 or Unix timestamp)
Number of data points (max: 1000)
Example Request
curl -X GET "https://api.matchr.xyz/v1/prices/history?market_id=mkt_yes123&interval=1h&limit=24" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
Whether the request succeeded
Array of OHLCV candles
ISO 8601 timestamp for the candle
Highest price in interval
Trading volume in interval (USD)
Example Response
{
"success": true,
"data": [
{
"timestamp": "2024-10-15T00:00:00Z",
"open": 0.49,
"high": 0.53,
"low": 0.48,
"close": 0.52,
"volume": 45000
},
{
"timestamp": "2024-10-15T01:00:00Z",
"open": 0.52,
"high": 0.54,
"low": 0.51,
"close": 0.53,
"volume": 38000
},
{
"timestamp": "2024-10-15T02:00:00Z",
"open": 0.53,
"high": 0.55,
"low": 0.52,
"close": 0.52,
"volume": 52000
}
],
"meta": {
"market_id": "mkt_yes123",
"interval": "1h",
"start": "2024-10-15T00:00:00Z",
"end": "2024-10-15T23:00:00Z"
}
}
Compare prices across platforms for matched markets.
Endpoint
GET https://api.matchr.xyz/v1/prices/compare
Query Parameters
Event ID to compare prices for
Example Request
curl -X GET "https://api.matchr.xyz/v1/prices/compare?event_id=evt_123" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"success": true,
"data": {
"event_id": "evt_123",
"title": "Will Trump win the 2024 election?",
"platforms": {
"polymarket": {
"market_id": "mkt_poly_123",
"yes_price": 0.52,
"no_price": 0.48,
"volume_24h": 500000,
"liquidity": 150000
},
"kalshi": {
"market_id": "mkt_kalshi_456",
"yes_price": 0.55,
"no_price": 0.45,
"volume_24h": 120000,
"liquidity": 80000
}
},
"spread_analysis": {
"yes_spread": 0.03,
"yes_spread_pct": 5.77,
"best_yes_buy": "polymarket",
"best_yes_sell": "kalshi",
"arbitrage_opportunity": true
}
}
}
WebSocket Price Stream
Subscribe to real-time price updates via WebSocket.
Endpoint
wss://api.matchr.xyz/v1/prices/stream
Subscribe Message
{
"action": "subscribe",
"market_ids": ["mkt_yes123", "mkt_no123"]
}
Price Update Message
{
"type": "price_update",
"market_id": "mkt_yes123",
"price": 0.53,
"best_bid": 0.52,
"best_ask": 0.54,
"volume_24h": 255000,
"timestamp": "2024-10-15T14:31:15Z"
}
Unsubscribe
{
"action": "unsubscribe",
"market_ids": ["mkt_yes123"]
}
Error Codes
| Code | Description |
|---|
400 | Invalid query parameters |
401 | Missing or invalid API key |
404 | Market not found |
429 | Rate limit exceeded |
500 | Server error |