# Coinbase Execution Cost: slippage, fees and depth by order size (`crystosix/coinbase-execution-cost`) Actor

What a market order really costs on Coinbase right now. Walks the live order book for up to 5 order sizes per product: average fill, slippage, fee, all-in cost in bps, and depth near mid. Read-only, no Coinbase account needed.

- **URL**: https://apify.com/crystosix/coinbase-execution-cost.md
- **Developed by:** [CrystoSIX Agents](https://apify.com/crystosix) (community)
- **Categories:** Developer tools, AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 product quoteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

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

## Coinbase Execution Cost: slippage, fees and depth by order size

Know what a trade will really cost **before** you place it. For each Coinbase product you list, this Actor walks the live public order book level by level and tells you, for up to five order sizes:

- **Average fill price** and **worst price** reached
- **Slippage** in basis points versus the mid price
- **Fee** and **all-in cost** (slippage plus fee) in basis points and in dollars
- How many book levels the order eats, and whether the visible book can fill it at all
- **Spread** and **depth** within 10, 50 and 100 bps of mid on both sides
- Warnings when a product is in limit-only, post-only, cancel-only or auction mode

No Coinbase account, no API keys, nothing is ever traded.

### Input

| Field | Meaning |
|---|---|
| `products` | Coinbase product ids, like `BTC-USD`, `ETH-USD`, `SOL-USDC`. Up to 200. |
| `side` | `buy`, `sell` or `both`. |
| `usdSizes` | Up to 5 order sizes in the quote currency, like `1000`, `25000`, `250000`. |
| `feeBps` | Your taker fee in basis points (60 = 0.60%). |

### Example row

`BTC-USD buy`: $1,000 costs about 60 bps all-in (all fee), $100,000 about 62 bps, $5,000,000 about 75 bps after walking ~300 levels.

### Ideas

- **Order sizing for bots and agents**: find the largest size you can trade before slippage passes your limit.
- **Liquidity screening**: run a list of altcoin pairs and drop any where $25k costs more than 50 bps.
- **Monitoring**: schedule every 15 minutes and chart how depth changes through the day.

### Pricing

You pay per product and side quoted. Unknown products and failed lookups are skipped and not charged.

*Estimates from the visible order book at the moment of the run. Real fills can be worse in fast markets, because other traders act too. Not financial advice.*

For AI agents: the same quote is available per call with x402 (USDC on Base, no account) at [crystosi.com](https://crystosi.com/llms.txt), with a free preview and an MCP tool.

# Actor input Schema

## `products` (type: `array`):

Coinbase product ids, one per line, like BTC-USD, ETH-USD, SOL-USDC. Up to 200.

## `side` (type: `string`):

Buy walks the asks, sell walks the bids. Both gives one row per side.

## `usdSizes` (type: `array`):

Up to 5 order sizes in the product's quote currency (USD for BTC-USD).

## `feeBps` (type: `integer`):

Your Coinbase taker fee in basis points: 60 = 0.60%. Used for the all-in cost.

## `crystosiTest` (type: `boolean`):

Used by CrystoSIX test runs only.

## Actor input object example

```json
{
  "products": [
    "BTC-USD",
    "ETH-USD",
    "SOL-USD"
  ],
  "side": "buy",
  "usdSizes": [
    "1000",
    "25000",
    "250000"
  ],
  "feeBps": 60
}
```

# Actor output Schema

## `results` (type: `string`):

One row per product and side: cost by order size, spread and depth.

# 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 = {
    "products": [
        "BTC-USD",
        "ETH-USD",
        "SOL-USD"
    ],
    "usdSizes": [
        "1000",
        "25000",
        "250000"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("crystosix/coinbase-execution-cost").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 = {
    "products": [
        "BTC-USD",
        "ETH-USD",
        "SOL-USD",
    ],
    "usdSizes": [
        "1000",
        "25000",
        "250000",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("crystosix/coinbase-execution-cost").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 '{
  "products": [
    "BTC-USD",
    "ETH-USD",
    "SOL-USD"
  ],
  "usdSizes": [
    "1000",
    "25000",
    "250000"
  ]
}' |
apify call crystosix/coinbase-execution-cost --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,crystosix/coinbase-execution-cost"
        }
    }
}
```

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/zE4sPbIcC3WM9gekT/builds/BK1hgdRtPXpMSA9o8/openapi.json
