# OKX Market Scraper (`logiover/okx-market-scraper`) Actor

Scrape live market data for all OKX spot and futures (swap) instruments in one run — last price, 24h change, high/low, volume, bid/ask and more. Schedule it for a continuously fresh price feed.

- **URL**: https://apify.com/logiover/okx-market-scraper.md
- **Developed by:** [Logiover](https://apify.com/logiover) (community)
- **Categories:** Automation, Developer tools
- **Stats:** 5 total users, 0 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## 🟢 OKX Market Scraper — Live OKX Spot & Futures Prices, Volume & Market Data

Scrape **live market data from OKX** — one of the world's leading cryptocurrency exchanges — straight from its official public API. This **OKX scraper** delivers a clean, structured snapshot of every OKX spot and futures (swap) instrument: last price, 24h change, high/low, 24h volume and bid/ask spread. Export to JSON, CSV or Excel.

Crypto prices move every second, so this Actor is built for **scheduled, recurring use** to keep a continuously fresh OKX market feed. **No login and no OKX API key required.**

### ✨ What this Actor does / Key features

- 📡 Pulls **live OKX market data** directly from the official OKX public API — fast, reliable and fully structured
- 🌐 **Complete market coverage** — every OKX SPOT and SWAP (perpetual futures) instrument in a single run, plus FUTURES and OPTION support
- 💹 Rich data per pair — last price, 24h open/high/low, 24h price change %, base and quote volume, bid and ask price
- 🔢 **Sort** instruments by quote volume, base volume, 24h price change or last price
- 🔍 **Filter** out low-volume instruments with a minimum 24h volume threshold
- ♾️ Leave the limit empty to pull every available pair, or cap the run with `maxPairs`
- 🤖 No API key, no login, no blocking — ideal for scheduled recurring runs
- 📤 Structured output ready for JSON, CSV and Excel export

### 🔍 Input

| Field | Type | Description |
|-------|------|-------------|
| `instTypes` | array | Which OKX markets to scrape: `SPOT`, `SWAP` (perpetual futures), `FUTURES`, `OPTION`. |
| `minVolumeUsd` | integer | Drop instruments with 24h quote volume below this value. `0` = no filter. |
| `sortBy` | string (select) | Rank instruments by `volCcy24h` (quote volume), `vol24h` (base volume), `priceChangePercent24h` or `lastPrice`. |
| `maxPairs` | integer | Maximum number of instruments to save. `0` = all. |

### 🚀 Example input

```json
{
  "instTypes": ["SPOT", "SWAP"],
  "minVolumeUsd": 100000,
  "sortBy": "volCcy24h",
  "maxPairs": 0
}
````

### 📦 Output

Each instrument is saved as one structured record.

| Field | Description |
|-------|-------------|
| `instId` | Instrument ID (e.g. `BTC-USDT`, `ETH-USDT-SWAP`) |
| `instType` | Instrument type — `SPOT`, `SWAP`, `FUTURES` or `OPTION` |
| `lastPrice` | Most recent traded price |
| `open24h` | Price 24 hours ago |
| `high24h` | Highest price in the last 24 hours |
| `low24h` | Lowest price in the last 24 hours |
| `priceChangePercent24h` | 24-hour price change as a percentage |
| `volume24h` | Trading volume in the last 24h (base currency) |
| `volumeCcy24h` | Trading volume in the last 24h (quote currency) |
| `bidPrice` | Current best bid price |
| `askPrice` | Current best ask price |
| `timestamp` | Exchange timestamp of the ticker data |
| `scrapedAt` | When the Actor scraped this record |

#### Sample record

```json
{
  "instId": "BTC-USDT",
  "instType": "SPOT",
  "lastPrice": 64235.1,
  "open24h": 63010.0,
  "high24h": 64880.0,
  "low24h": 62700.0,
  "priceChangePercent24h": 1.94,
  "volume24h": 12850.4,
  "volumeCcy24h": 821400000.0,
  "bidPrice": 64234.9,
  "askPrice": 64235.2,
  "timestamp": "2026-05-14T09:00:00.000Z",
  "scrapedAt": "2026-05-14T09:00:01.250Z"
}
```

### 💡 Use cases

- **Traders & trading bots** — feed live OKX prices and spreads into strategies, screeners and dashboards.
- **Market researchers & analysts** — track volume, volatility and 24h trends across the entire OKX exchange.
- **Price monitoring & alerts** — watch specific pairs on a schedule and trigger alerts on price moves.
- **Quant & data science teams** — build a historical OKX market-data archive by running the Actor on a recurring schedule.
- **Portfolio & PnL tools** — pull current prices to value crypto holdings in real time.

### ❓ Frequently Asked Questions

**Do I need an OKX account or API key?**
No. The Actor uses the official OKX public market API — no login, no API key and no authentication required.

**Is this legal?**
The Actor reads publicly available market data from OKX's official public API. Use the data responsibly and in line with OKX's terms of service.

**How much data can I get in one run?**
Leave `maxPairs` at `0` to pull every available instrument for the selected `instTypes` — that can be thousands of spot and swap pairs in a single run.

**Can I filter and sort the results?**
Yes. Use `minVolumeUsd` to drop low-volume instruments and `sortBy` to rank results by quote volume, base volume, 24h price change or last price.

**How fresh is the data?**
Each run pulls a live snapshot from OKX. Because crypto prices change constantly, schedule the Actor to run every few minutes for a near-real-time feed.

**Can I scrape only futures or only spot?**
Yes. Set `instTypes` to just `["SPOT"]`, just `["SWAP"]`, or any combination of `SPOT`, `SWAP`, `FUTURES` and `OPTION`.

**What output formats are supported?**
Results are stored in an Apify dataset and can be exported as JSON, CSV, Excel, XML or HTML, or pulled via the Apify API.

### ⏰ Scheduling & integration

Schedule this Actor on Apify to run every few minutes, hourly or daily for a continuously updated OKX market dataset with zero manual work. Export to JSON, CSV or Excel, call it via the Apify API, or push results to Google Sheets, databases and webhooks through Apify integrations.

# Actor input Schema

## `instTypes` (type: `array`):

Which OKX markets to scrape: 'SPOT', 'SWAP' (perpetual futures), 'FUTURES', 'OPTION'.

## `minVolumeUsd` (type: `integer`):

Drop instruments with 24h quote volume below this. 0 = no filter.

## `sortBy` (type: `string`):

Rank the instruments by this metric.

## `maxPairs` (type: `integer`):

Maximum instruments to save. 0 = all.

## Actor input object example

```json
{
  "instTypes": [
    "SPOT",
    "SWAP"
  ],
  "minVolumeUsd": 0,
  "sortBy": "volCcy24h"
}
```

# Actor output Schema

## `instId` (type: `string`):

instId

## `instType` (type: `string`):

instType

## `lastPrice` (type: `string`):

lastPrice

## `priceChangePercent24h` (type: `string`):

priceChangePercent24h

## `high24h` (type: `string`):

high24h

## `low24h` (type: `string`):

low24h

## `volumeCcy24h` (type: `string`):

volumeCcy24h

# 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 = {
    "instTypes": [
        "SPOT",
        "SWAP"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("logiover/okx-market-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 = { "instTypes": [
        "SPOT",
        "SWAP",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("logiover/okx-market-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "instTypes": [
    "SPOT",
    "SWAP"
  ]
}' |
apify call logiover/okx-market-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=logiover/okx-market-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "OKX Market Scraper",
        "description": "Scrape live market data for all OKX spot and futures (swap) instruments in one run — last price, 24h change, high/low, volume, bid/ask and more. Schedule it for a continuously fresh price feed.",
        "version": "1.0",
        "x-build-id": "zvreyYg2m6juGqdgV"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/logiover~okx-market-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-logiover-okx-market-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/logiover~okx-market-scraper/runs": {
            "post": {
                "operationId": "runs-sync-logiover-okx-market-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/logiover~okx-market-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-logiover-okx-market-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "instTypes": {
                        "title": "Instrument Types",
                        "type": "array",
                        "description": "Which OKX markets to scrape: 'SPOT', 'SWAP' (perpetual futures), 'FUTURES', 'OPTION'.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "minVolumeUsd": {
                        "title": "Minimum 24h Volume",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Drop instruments with 24h quote volume below this. 0 = no filter.",
                        "default": 0
                    },
                    "sortBy": {
                        "title": "Sort By",
                        "enum": [
                            "volCcy24h",
                            "vol24h",
                            "priceChangePercent24h",
                            "lastPrice"
                        ],
                        "type": "string",
                        "description": "Rank the instruments by this metric.",
                        "default": "volCcy24h"
                    },
                    "maxPairs": {
                        "title": "Max Pairs",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum instruments to save. 0 = all."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
