# Phemex Crypto Tickers Scraper (`muhammadafzal/phemex-crypto-tickers-scraper`) Actor

Scrape public Phemex 24-hour spot and perpetual tickers for market monitoring, quantitative research, dashboards, and AI agents. Returns normalized prices, spreads, 24h change, volume, funding, mark/index price, and open interest. Not for trading or historical data. $0.002/ticker.

- **URL**: https://apify.com/muhammadafzal/phemex-crypto-tickers-scraper.md
- **Developed by:** [Muhammad Afzal](https://apify.com/muhammadafzal) (community)
- **Categories:** MCP servers, Automation
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 ticker scrapeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Phemex Crypto Tickers Scraper

Collect public Phemex 24-hour crypto ticker data for spot markets or perpetual contracts. The actor is keyless and returns clean, flat records for market monitoring, trading dashboards, quantitative research, portfolio automation, and AI-agent workflows.

### What it extracts

| Field | Description |
| --- | --- |
| `symbol`, `baseAsset`, `quoteAsset` | Phemex market identity; spot symbols use Phemex's `s` prefix in the raw symbol. |
| `lastPrice`, `bidPrice`, `askPrice` | Current public prices, normalized from Phemex scaled spot values where applicable. |
| `openPrice`, `highPrice`, `lowPrice` | Rolling 24-hour price statistics. |
| `priceChange24h`, `priceChangePercent24h` | Change calculated from Phemex's 24-hour open and last prices. |
| `volume24h`, `turnover24h` | Phemex-reported rolling 24-hour activity. |
| `indexPrice`, `markPrice`, `fundingRate`, `predictedFundingRate`, `openInterest` | Perpetual-contract fields; `null` for spot markets. |
| `timestamp`, `tickerUrl`, `scrapedAt`, `warnings` | Source time, traceability, collection time, and diagnostics. |

### When to use it

Use this actor when you need a current Phemex market snapshot in a dataset or through the Apify API/MCP integration. It queries Phemex's public market-data API directly and does not require a Phemex account, API key, cookies, browser automation, or trading permissions.

Do not use it for historical candles, order-book snapshots, trades, account balances, order placement, liquidation data, or guaranteed real-time streaming. Use a WebSocket or a dedicated historical-data source for those tasks.

### Input

```json
{
  "marketType": "spot",
  "symbols": ["BTCUSDT", "ETHUSDT"],
  "quoteAsset": "USDT",
  "maxResults": 50
}
```

`marketType` accepts `spot` (default) or `perpetual`. For spot, you may enter `BTCUSDT`; the actor normalizes it to Phemex's documented `sBTCUSDT` symbol. Leave `symbols` empty to collect the selected market endpoint's tickers, subject to the `maxResults` cap. `quoteAsset` is an optional local filter. `maxResults` defaults to 200 and is capped at 1,000.

The actor retries temporary public API failures up to two times by default and applies a 20-second request timeout. Both settings can be adjusted within safe schema limits.

### Filtering and scheduling

For a quick market snapshot, leave `symbols` empty and use a modest `maxResults` value. For a watchlist, pass the symbols you need and run the actor on a schedule. Spot inputs such as `BTCUSDT` and `sBTCUSDT` resolve to the same Phemex market. Perpetual inputs use the regular contract symbol, such as `BTCUSDT`.

`quoteAsset` is applied after the public response is received. It is useful for narrowing a broad snapshot to USDT or USDC markets, but it does not alter Phemex's upstream request. When a valid filter produces no rows, the actor exits successfully and records an actionable warning in both `OUTPUT` and `SUMMARY`. This makes empty watchlists distinguishable from failed API requests.

The actor collects a point-in-time snapshot. Schedule it at the interval appropriate for your workflow and store each run's dataset separately if you need a time series. It does not deduplicate records across runs because repeated snapshots are often the desired input for monitoring and charting. Use `scrapedAt` for collection time and `timestamp` for the exchange-provided ticker time.

### Data interpretation

Spot prices use Phemex's scaled integer fields and are converted to ordinary decimal numbers. Perpetual v3 prices are read from Phemex's real-price fields. `priceChange24h` and `priceChangePercent24h` are calculated from the returned open and last prices, while volume and turnover retain the units supplied by Phemex. Perpetual funding and open-interest values are not inferred for spot markets; those fields remain explicitly `null` so downstream schemas stay stable.

Always validate freshness before using a ticker in an automated decision. Exchange APIs can experience maintenance, network delay, temporary rate limits, or symbol changes. The actor reports upstream request failures and filter misses instead of turning them into an unexplained empty result. For high-frequency trading, use Phemex's authorized streaming and trading interfaces rather than this batch snapshot actor.

### Output example

```json
{
  "marketType": "spot",
  "symbol": "sBTCUSDT",
  "baseAsset": "BTC",
  "quoteAsset": "USDT",
  "lastPrice": 65000.12,
  "bidPrice": 65000.1,
  "askPrice": 65000.2,
  "openPrice": 64000,
  "highPrice": 66000,
  "lowPrice": 63000,
  "priceChange24h": 1000.12,
  "priceChangePercent24h": 1.5626875,
  "volume24h": 12345.6,
  "turnover24h": 789012345.67,
  "indexPrice": null,
  "markPrice": null,
  "fundingRate": null,
  "predictedFundingRate": null,
  "openInterest": null,
  "timestamp": "2026-08-01T12:00:00.000Z",
  "tickerUrl": "https://api.phemex.com/md/spot/ticker/24hr?symbol=sBTCUSDT",
  "source": "Phemex public market-data API",
  "scrapedAt": "2026-08-01T12:00:01.000Z",
  "warnings": []
}
```

Perpetual results use Phemex's recommended v3 endpoint and include derivative fields when returned. Spot and perpetual records share the same stable shape so downstream AI-agent and ETL workflows do not need separate parsers.

### API and MCP usage

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('YOUR_USERNAME/phemex-crypto-tickers-scraper').call({
  marketType: 'perpetual',
  symbols: ['BTCUSDT'],
  maxResults: 1
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0]);
```

Use the actor through Apify's hosted MCP integration when an AI agent needs a narrow Phemex market-data tool. The input is limited to market family and filters; the output is one normalized ticker per dataset item plus a machine-readable run summary.

### Pricing

The actor is configured for predictable pay-per-event pricing: a small actor-start event and a primary $0.002 event for each ticker record written. A run capped at 50 records is capped at approximately $0.10005 in actor events, excluding ordinary Apify compute and any applicable platform charges. The final dataset count and warnings are stored in `SUMMARY` and `OUTPUT`.

### Reliability and responsible use

The actor uses Phemex's public REST endpoints, bounded retries, request timeouts, and explicit diagnostics. If Phemex returns an empty response or a temporary error, the actor preserves the run summary and reports the condition rather than silently presenting stale data. Public ticker values can change between collection and use; verify prices before making material decisions.

This independent tool is not affiliated with Phemex. You are responsible for complying with Phemex's terms, applicable law, and any market-data licensing requirements. It does not place trades or access private account information.

### FAQ

#### Does the actor require a Phemex API key?

No. It uses only Phemex's public market-data endpoints. It never asks for account credentials, cookies, signing secrets, or trading permissions.

#### Why do spot symbols contain a lowercase `s`?

Phemex documents spot symbols with an `s` prefix, for example `sBTCUSDT`. The input normalizer accepts either form, while output preserves the documented spot symbol so it can be used in source links and follow-up API requests.

#### Can I get historical prices or candles?

No. Each row is a current 24-hour ticker snapshot. Use a historical market-data endpoint or a scheduled series of actor runs when you need time-based analysis.

#### What happens when Phemex returns no matching market?

The actor completes with a truthful empty dataset and writes a warning to `OUTPUT` and `SUMMARY`. Check the exact symbol spelling, the spot `s` prefix behavior, and the selected quote asset before retrying.

# Actor input Schema

## `marketType` (type: `string`):

Use this when choosing which public Phemex market-data endpoint to query. Select 'spot' for spot markets or 'perpetual' for perpetual contracts. Defaults to spot. This is not a historical-data or trading-order mode.

## `symbols` (type: `array`):

Use this when you need only selected Phemex markets, such as \['BTCUSDT', 'ETHUSDT']. Leave empty to collect all tickers returned by the selected endpoint. Spot symbols may be supplied without the documented s-prefix; the actor normalizes them. This is not a list of coin names for other exchanges.

## `quoteAsset` (type: `string`):

Use this when filtering the returned rows by quote currency, for example USDT or USDC. Leave blank to keep all quote assets. This filters output after the public Phemex response and does not change the upstream endpoint.

## `maxResults` (type: `integer`):

Use this to cap the number of ticker records written to the dataset. Enter 1 to 1000; the default is 200. This is a result cap, not a pagination setting, and the actor never writes more rows than this value.

## `maxRequestRetries` (type: `integer`):

Use this when allowing recovery from temporary public API failures such as 429 or 5xx responses. Enter 0 to 4; the default is 2. Retries use short exponential backoff and do not bypass access controls.

## `requestTimeoutMs` (type: `integer`):

Use this when adjusting how long the actor waits for Phemex's public API response. Enter 5000 to 60000 milliseconds; the default is 20000. Increase it only for transient network latency, not for historical or streaming collection.

## Actor input object example

```json
{
  "marketType": "spot",
  "symbols": [],
  "quoteAsset": "",
  "maxResults": 200,
  "maxRequestRetries": 2,
  "requestTimeoutMs": 20000
}
```

# Actor output Schema

## `dataset` (type: `string`):

Default dataset containing one normalized ticker per item.

## `summary` (type: `string`):

KV summary with filters, counts, and diagnostics.

## `output` (type: `string`):

KV output object for API and agent workflows.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "marketType": "spot",
    "symbols": [],
    "maxResults": 200
};

// Run the Actor and wait for it to finish
const run = await client.actor("muhammadafzal/phemex-crypto-tickers-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "marketType": "spot",
    "symbols": [],
    "maxResults": 200,
}

# Run the Actor and wait for it to finish
run = client.actor("muhammadafzal/phemex-crypto-tickers-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "marketType": "spot",
  "symbols": [],
  "maxResults": 200
}' |
apify call muhammadafzal/phemex-crypto-tickers-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muhammadafzal/phemex-crypto-tickers-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/9EPxRKB3QYcRNVorl/builds/RyMwZ0FlHA7Qo6Cqo/openapi.json
