Skip to main content
GET
/
v1
/
predexon
/
market-price
/
{token_id}
curl -s "https://api.predexon.com/v1/predexon/market-price/0x1234567890abcdef1234567890abcdef12345678" \
  -H "x-api-key: YOUR_API_KEY"
{
  "price": 0.6234,
  "at_time": 1735660800
}

Market Price

GET /v1/predexon/market-price/{token_id} — Retrieve the current or historical market price for a token at a specific point in time.
  • Base URL: https://api.predexon.com/v1
  • Auth: x-api-key: YOUR_API_KEY
  • Time: All timestamps are Unix timestamps (seconds) unless otherwise noted
  • Rate Limits: 100 requests/minute per API key. Returns 429 with Retry-After header (seconds) when exceeded. Use exponential backoff on 429/503 responses.

Endpoint

GET /v1/predexon/market-price/{token_id}

Path parameters

ParameterTypeDescription
token_idstringToken identifier (Ethereum address format, e.g., 0x1234...). Required.

Query parameters

All parameters are optional.
ParameterTypeDescription
at_timeintegerUnix timestamp (in seconds) for historical price. If not provided, returns current price. Must be non-negative.

Response schema

{
  "price": 0.6234,
  "at_time": 1735660800
}

Field reference

FieldTypeDescription
pricefloatToken price as a decimal value between 0.0 and 1.0.
at_timeintegerUnix timestamp (seconds) indicating when the price was recorded or requested.
Understanding price values
  • Token prices are normalized between 0.0 and 1.0, representing the probability or market valuation.
  • Price 0.6234 means approximately 62.34% probability or valuation.
  • Historical prices are snapshotted at the requested at_time or the nearest available historical point.

Examples

curl -s "https://api.predexon.com/v1/predexon/market-price/0x1234567890abcdef1234567890abcdef12345678" \
  -H "x-api-key: YOUR_API_KEY"
{
  "price": 0.6234,
  "at_time": 1735660800
}

Errors

All errors return standard HTTP status codes with JSON error responses:
{
  "error": {
    "type": "invalid_parameter",
    "message": "at_time must be a non-negative integer",
    "param": "at_time"
  }
}
HTTP StatusError TypeDescriptionCommon Causes
400invalid_parameterParameter validation failedNegative at_time, invalid token_id format
401unauthorizedAuthentication failedMissing or invalid x-api-key header
403insufficient_permissionsAPI key lacks required permissionsToken not provisioned for Market Price API
404not_foundResource doesn’t existUnknown token_id
429rate_limit_exceededToo many requestsExceeded 100 requests/minute. Check Retry-After header.
500internal_errorServer errorContact team@predexon.com with request ID
503service_unavailableTemporary service issueRetry with exponential backoff

Use Cases

Price Monitoring

Monitor real-time token prices for dashboards, alerts, and trading systems. This lightweight endpoint is optimized for frequent polling without heavy payload overhead.
# Monitor price changes and trigger alerts
import requests

def check_price_alert(token_id: str, threshold: float, api_key: str):
    res = requests.get(
        f"https://api.predexon.com/v1/predexon/market-price/{token_id}",
        headers={"x-api-key": api_key}
    )
    data = res.json()

    if data["price"] > threshold:
        print(f"ALERT: Price {data['price']} exceeded threshold {threshold}")

Historical Analysis

Retrieve historical prices at specific timestamps for backtesting, performance analysis, and historical reporting. Build time series data by querying multiple timestamps.
# Retrieve prices over time for analysis
import requests
from datetime import datetime, timedelta

def get_price_series(token_id: str, start_time: int, end_time: int,
                     interval: int, api_key: str):
    """Retrieve prices at regular intervals"""
    prices = []
    current_time = start_time

    while current_time <= end_time:
        res = requests.get(
            f"https://api.predexon.com/v1/predexon/market-price/{token_id}",
            headers={"x-api-key": api_key},
            params={"at_time": current_time}
        )
        prices.append(res.json())
        current_time += interval

    return prices

# Get hourly prices for the last week
now = int(datetime.now().timestamp())
one_week_ago = now - (7 * 24 * 3600)
prices = get_price_series(token_id, one_week_ago, now, 3600, api_key)

Alert Systems

Build automated alert systems that trigger notifications based on price movements, threshold breaches, or specific market conditions. Perfect for integration with monitoring platforms.
# Send notifications on price movements
import requests
import json

class PriceAlertSystem:
    def __init__(self, token_id: str, api_key: str):
        self.token_id = token_id
        self.api_key = api_key
        self.last_price = None

    def check_for_alerts(self, alert_threshold: float = 0.05):
        """Check if price changed by more than threshold"""
        res = requests.get(
            f"https://api.predexon.com/v1/predexon/market-price/{self.token_id}",
            headers={"x-api-key": self.api_key}
        )
        current_price = res.json()["price"]

        if self.last_price is not None:
            change = abs(current_price - self.last_price)
            if change > alert_threshold:
                self.send_alert(current_price, change)

        self.last_price = current_price

    def send_alert(self, price: float, change: float):
        # Send to your alerting system (Slack, email, webhook, etc.)
        print(f"Price alert: {price} (change: {change})")

Integration with Market Data Pipelines

Combine with other endpoints to build comprehensive market data pipelines. Use market-price for quick lookups alongside candlestick data for technical analysis.
# Combine current and historical data
import requests

def get_market_snapshot(token_id: str, api_key: str):
    """Get current price and recent historical point"""
    current = requests.get(
        f"https://api.predexon.com/v1/predexon/market-price/{token_id}",
        headers={"x-api-key": api_key}
    ).json()

    one_hour_ago = int(datetime.now().timestamp()) - 3600
    historical = requests.get(
        f"https://api.predexon.com/v1/predexon/market-price/{token_id}",
        headers={"x-api-key": api_key},
        params={"at_time": one_hour_ago}
    ).json()

    return {
        "current_price": current["price"],
        "historical_price": historical["price"],
        "change": current["price"] - historical["price"],
        "change_pct": ((current["price"] - historical["price"]) / historical["price"]) * 100
    }

Best Practices

  1. Cache strategically: Current prices change frequently, but historical prices are immutable. Cache historical queries by token_id + at_time key.
  2. Batch historical requests: When retrieving multiple historical points, consider the time interval between requests to optimize API quota usage.
  3. Handle rate limits: Implement exponential backoff when receiving 429 responses. Check the Retry-After header for guidance.
  4. Validate timestamps: Ensure at_time values are valid Unix timestamps and represent times when markets were active.
  5. Convert timestamps: Store and work with Unix timestamps internally, but convert to ISO-8601 or human-readable formats for display purposes.
  6. Monitor API health: Track response times and error rates. Alert on unusual patterns that may indicate market disruptions.