# Cryptocurrency Price API (`shahidirfan/cryptocurrency-prices`) Actor

Instantly fetch live cryptocurrency prices and market trends. This lightweight actor delivers accurate financial data for your analysis or application. Fast, efficient, and easy to integrate, it provides the real-time insights you need to track market movements effortlessly.

- **URL**: https://apify.com/shahidirfan/cryptocurrency-prices.md
- **Developed by:** [Shahid Irfan](https://apify.com/shahidirfan) (community)
- **Categories:** Automation, Developer tools, Other
- **Features:** Limited permissions
- **Stats:** 16 total users, 3 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Cryptocurrency Prices Scraper

Extract real-time cryptocurrency prices, market capitalization, and trading volumes with ease. Collect comprehensive market data for thousands of coins, including trending and newly launched assets. Perfect for market analysis, portfolio tracking, and building financial dashboards.

***

### Features

- **Real-Time Data** — Get the latest prices and market metrics instantly
- **Trending & New Coins** — Track currently trending assets and recently launched cryptocurrencies
- **Multi-Currency Support** — Convert all data into USD, EUR, GBP, JPY, CAD, AUD, INR, or BRL
- **Historical Sparklines** — Optional 7-day price history data for trend visualization
- **Comprehensive Metrics** — Extract market cap, 24h volume, price changes, and supply data
- **Automated Fallback** — Reliable data collection with built-in redundancy for maximum uptime

***

### Use Cases

#### Market Intelligence

Monitor the entire cryptocurrency market to identify emerging trends and shifts in market capitalization. Track high-volume assets to understand liquidity and market sentiment.

#### Portfolio Management

Keep your investment tracking apps updated with accurate, real-time price data. Automate the collection of asset values across multiple currencies for global reporting.

#### Financial Research

Build historical datasets for quantitative analysis. Use the 7-day sparkline data to visualize short-term price movements and volatility across different asset classes.

#### Content Creation

Power your financial news site or social media bots with automated updates on trending coins and new market entrants. Provide your audience with up-to-the-minute market stats.

***

### Input Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `cryptoIds` | Array | No | `[]` | List of specific coin IDs (e.g., `["bitcoin", "ethereum"]`) |
| `results_wanted` | Integer | No | `20` | Number of cryptocurrencies to fetch (1-5000) |
| `order` | String | No | `"market_cap_desc"` | Sort order (market cap, volume, trending, newly launched) |
| `vsCurrency` | String | No | `"usd"` | Target currency for price conversion |
| `sparkline` | Boolean | No | `false` | Include 7-day price history data |
| `includeMarketCap` | Boolean | No | `true` | Include market capitalization data |
| `includeVolume` | Boolean | No | `true` | Include 24-hour trading volume |

***

### Output Data

Each item in the dataset contains:

| Field | Type | Description |
|-------|------|-------------|
| `id` | String | Unique cryptocurrency identifier |
| `symbol` | String | Ticker symbol (e.g., BTC) |
| `name` | String | Full asset name |
| `current_price` | Number | Price in the selected currency |
| `market_cap` | Number | Total market capitalization |
| `total_volume` | Number | 24-hour trading volume |
| `price_change_percentage_24h` | Number | 24h price movement percentage |
| `sparkline_7d` | Array | 7-day historical price points |

***

### Usage Examples

#### Top 10 Market Leaders

Fetch the top 10 cryptocurrencies by market cap in USD:

```json
{
    "results_wanted": 10,
    "order": "market_cap_desc",
    "vsCurrency": "usd"
}
```

#### Trending Assets in Euro

Extract the top 20 trending coins with prices converted to EUR:

```json
{
    "results_wanted": 20,
    "order": "trending",
    "vsCurrency": "eur"
}
```

#### Specific Asset Tracking

Get detailed metrics for Bitcoin and Ethereum with price history:

```json
{
    "cryptoIds": ["bitcoin", "ethereum"],
    "sparkline": true,
    "vsCurrency": "gbp"
}
```

***

### Sample Output

```json
{
  "id": "bitcoin",
  "symbol": "BTC",
  "name": "Bitcoin",
  "current_price": 65250.5,
  "market_cap": 1289632500000,
  "market_cap_rank": 1,
  "total_volume": 35500000000,
  "price_change_percentage_24h": 1.8,
  "last_updated": "2024-12-21T10:30:45.000Z",
  "sparkline_7d": [63250, 63800, 64200, 64900, 65100, 65300, 65250]
}
```

***

### Tips for Best Results

#### Optimize for Speed

- Set `results_wanted` to exactly what you need (default is 20)
- Disable `sparkline` if you don't need historical data to reduce payload size
- Use `cryptoIds` for specific assets to skip general market processing

#### Currency Accuracy

- Ensure your `vsCurrency` matches your reporting requirements
- All numerical fields like market cap and volume will be converted automatically

***

### Integrations

Connect your cryptocurrency data with:

- **Google Sheets** — Export directly for analysis and charts
- **Excel** — Build advanced financial models
- **Zapier** — Trigger alerts when prices hit targets
- **Webhooks** — Send data to your custom trading dashboards

#### Export Formats

- **JSON** — For developers and application integration
- **CSV** — For spreadsheet analysis and reporting
- **XML** — For legacy system compatibility

***

### Frequently Asked Questions

#### Which coins can I fetch?

You can fetch data for any cryptocurrency available on the platform. Use `cryptoIds` for specific coins or browse by rank.

#### How often is data updated?

The data is retrieved in real-time. For frequent monitoring, you can schedule the scraper to run at regular intervals.

#### Can I get historical prices?

Yes, enable the `sparkline` option to receive the last 7 days of price movement data.

#### Is there a limit on results?

You can request up to 5,000 assets in a single run. For larger datasets, we recommend multiple targeted runs.

#### Do I need a proxy?

The scraper includes built-in handling, but for high-frequency fallback scraping, residential proxies are recommended.

***

### Support

For issues or feature requests, contact support through the Apify Console.

#### Resources

- [Apify Documentation](https://docs.apify.com/)
- [API Reference](https://docs.apify.com/api/v2)
- [Scheduling Runs](https://docs.apify.com/schedules)

***

### Legal Notice

This actor is designed for legitimate data collection purposes. Users are responsible for ensuring compliance with website terms of service and applicable laws. Use data responsibly and respect rate limits.credentials.

# Actor input Schema

## `cryptoIds` (type: `array`):

Specify cryptocurrency IDs to fetch exact coins (e.g., bitcoin, ethereum, cardano). Leave empty to fetch top cryptocurrencies based on the Results Wanted parameter.

## `results_wanted` (type: `integer`):

Number of top cryptocurrencies to fetch (1-5000).

## `order` (type: `string`):

Sort cryptocurrencies by different metrics or view trending and newly launched

## `vsCurrency` (type: `string`):

Currency to display prices in

## `sparkline` (type: `boolean`):

Include 7-day price history data for visualization

## `includeMarketCap` (type: `boolean`):

Include market capitalization data

## `includeVolume` (type: `boolean`):

Include 24-hour trading volume data

## `include24hChange` (type: `boolean`):

Include 24-hour price change percentage

## `proxyConfiguration` (type: `object`):

Configure proxy for requests (only needed for website fallback scraping)

## Actor input object example

```json
{
  "cryptoIds": [
    "bitcoin",
    "ethereum"
  ],
  "results_wanted": 20,
  "order": "market_cap_desc",
  "vsCurrency": "usd",
  "sparkline": false,
  "includeMarketCap": true,
  "includeVolume": true,
  "include24hChange": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

# 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 = {
    "cryptoIds": [
        "bitcoin",
        "ethereum"
    ],
    "results_wanted": 20,
    "order": "market_cap_desc",
    "vsCurrency": "usd",
    "sparkline": false,
    "includeMarketCap": true,
    "includeVolume": true,
    "include24hChange": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("shahidirfan/cryptocurrency-prices").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 = {
    "cryptoIds": [
        "bitcoin",
        "ethereum",
    ],
    "results_wanted": 20,
    "order": "market_cap_desc",
    "vsCurrency": "usd",
    "sparkline": False,
    "includeMarketCap": True,
    "includeVolume": True,
    "include24hChange": True,
}

# Run the Actor and wait for it to finish
run = client.actor("shahidirfan/cryptocurrency-prices").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 '{
  "cryptoIds": [
    "bitcoin",
    "ethereum"
  ],
  "results_wanted": 20,
  "order": "market_cap_desc",
  "vsCurrency": "usd",
  "sparkline": false,
  "includeMarketCap": true,
  "includeVolume": true,
  "include24hChange": true
}' |
apify call shahidirfan/cryptocurrency-prices --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,shahidirfan/cryptocurrency-prices"
        }
    }
}
```

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/U1nVfdgJNkVUXg1Ag/builds/cGFnTUgTJPxD6exeS/openapi.json
