# Crypto Perp Funding Rate, OI & Delta-Neutral Carry Arbitrage (`conscious_chuckwalla/crypto-funding-rate-carry-arb`) Actor

Real-time crypto perpetual futures funding rates, open interest, mark-index basis, extreme cash-and-carry anomalies, and fee-adjusted cross-venue delta-neutral carry arbitrage across Hyperliquid, dYdX v4, Kraken Futures & OKX. 100% public APIs, AI Agent & MCP ready.

- **URL**: https://apify.com/conscious_chuckwalla/crypto-funding-rate-carry-arb.md
- **Developed by:** [Larry Wong](https://apify.com/conscious_chuckwalla) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 normalized perp market snapshots

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

## Crypto Perp Funding Rate, Open Interest & Delta-Neutral Carry Arbitrage

Institutional-grade **crypto perpetual futures funding rate, open interest, mark-index basis, and cross-venue delta-neutral carry arbitrage engine** built for quantitative traders, automated basis bots, and AI Agents via **Apify REST API & Model Context Protocol (MCP)**.

Queries **100% public, zero-authentication, US-cloud-safe exchanges** concurrently in **< 3 seconds**:

- **Hyperliquid DEX** (`POST https://api.hyperliquid.xyz/info` — 1h continuous funding, mark/oracle basis, USD OI & 24h notional volume)
- **dYdX v4 Chain Indexer** (`GET https://indexer.dydx.trade/v4/perpetualMarkets` — decentralized L1 orderbook perps, 1h funding & OI)
- **Kraken Futures** (`GET https://futures.kraken.com/derivatives/api/v3/tickers` — regulated linear `PF_*` perpetuals, hourly relative funding, mark/index basis & OI)
- **OKX Swap** (`GET https://www.okx.com/api/v5/...` — linear `*-USDT-SWAP` perpetuals with dynamic 1h/2h/4h/8h interval normalization, USD OI & index basis)
- **Bitget USDT Futures** *(optional 5th venue)* (`GET https://api.bitget.com/api/v2/mix/market/...`)

> **Zero Geo-Blocking / Zero 451 Errors**: Never touches US-blocked endpoints (`fapi.binance.com` / `api.bybit.com`). Runs reliably 24/7 on Apify Cloud US AWS infrastructure without proxies or API keys.

***

### Core Quantitative Capabilities

1. **Canonical Multi-Venue Symbol & Multiplier Normalization**
   - Automatically maps `PF_XBTUSD -> BTC` and scales `1000x` / `1,000,000x` contracts (`kPEPE`, `1000PEPE`, `kBONK`, `kSHIB`, `kFLOKI`, `1000000MOG`, etc.) to **1-token canonical prices** while preserving dimensionless funding rates and USD open interest.
   - Enforces an **8% cross-venue mark-price parity guard** so unrelated tokens sharing a ticker across exchanges are never falsely paired.

2. **Standardized Funding & Basis Telemetry**
   - `funding_rate_hourly`: Normalized 1-hour funding rate fraction
   - `funding_rate_8h_equiv`: Standardized 8-hour equivalent funding rate
   - `funding_apr_pct`: Annualized funding yield (`hourly * 24 * 365 * 100`)
   - `mark_index_basis_bps`: `(mark_price - index_price) / index_price * 10,000`
   - `open_interest_usd` & `volume_24h_usd`

3. **Fee-Adjusted Cross-Venue Delta-Neutral Carry Arbitrage Engine**
   - Pairs `short_venue` (highest `funding_apr_pct`) against `long_venue` (lowest `funding_apr_pct`) across all assets meeting `minOpenInterestUsd` (default `$100,000` per leg).
   - Deducts realistic **4-fill entry + exit taker fees** across both legs (`Hyperliquid 3.5 bps`, `dYdX 5.0 bps`, `Kraken 5.0 bps`, `OKX 5.0 bps`, `Bitget 6.0 bps`) amortized over configurable `holdingDays` (default `7` days):
     - `gross_spread_apr_pct = short_apr_pct - long_apr_pct`
     - `net_carry_apr_pct = gross_spread_apr_pct - annualized_fee_drag_pct`
     - `breakeven_hours`: Exact hours of continuous funding spread needed to earn back round-trip fees
     - `deployable_capacity_usd`: Conservative `2% * min(short_oi_usd, long_oi_usd)` sizing benchmark
     - `basis_convergence_bonus_bps`: `short_mark_index_basis_bps - long_mark_index_basis_bps`

4. **Extreme Single-Venue Cash-and-Carry Anomaly Detector**
   - Flags liquid perpetual contracts with `|funding_apr_pct| >= 50%` (configurable) for **Spot + Perp Cash-and-Carry** (`LONG Spot + SHORT Perp` when funding is deeply positive, or `LONG Perp + Hedge Spot` when deeply negative).

***

### Pay-Per-Event (PPE) Pricing

| Event Name | Description | Unit Price (USD) |
|---|---|---:|
| `actor-start` | Flat initialization charge per live multi-venue scan | `$0.005` |
| `perp-market-record` | Per normalized perpetual contract snapshot pushed to dataset | `$0.001` |
| `carry-arbitrage-signal` | Per verified cross-venue delta-neutral carry signal or extreme anomaly | `$0.010` |

Use `maxResults` (default `60`) or Apify's built-in **Maximum cost per run** cap for deterministic budget control.

***

### Quick Start — Python SDK

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_API_TOKEN")

run = client.actor("conscious_chuckwalla/crypto-funding-rate-carry-arb").call(
    run_input={
        "mode": "all",
        "venues": ["hyperliquid", "dydx", "kraken", "okx"],
        "minOpenInterestUsd": 250000,
        "holdingDays": 7,
        "maxResults": 60,
    }
)

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    if item["record_type"] == "cross_venue_carry":
        print(item["symbol"], item["net_carry_apr_pct"], item["execution_plan"])
```

### AI Agent & MCP Integration

Add `conscious_chuckwalla/crypto-funding-rate-carry-arb` to your Apify MCP server (`https://mcp.apify.com`) so Claude, Cursor, OpenAI Agents, or LangGraph bots can ask:

> *"Scan Hyperliquid, dYdX, Kraken, and OKX for delta-neutral crypto funding carry trades with at least $500k open interest per leg and <48h fee breakeven."*

# Actor input Schema

## `mode` (type: `string`):

Choose which records to emit. 'all' outputs cross-venue delta-neutral carry signals, extreme single-venue cash-and-carry anomalies, and top normalized perpetual markets. 'carry_arbitrage' emits only cross-venue carry pairs. 'extreme_anomalies' emits only |APR| >= threshold single-venue opportunities. 'markets' emits normalized perpetual snapshots.

## `venues` (type: `array`):

US-accessible perpetual exchanges queried concurrently via official public APIs. Supported values: 'hyperliquid', 'dydx', 'kraken', 'okx', 'bitget'. Include at least 2 venues for cross-venue carry arbitrage.

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

Optional list of canonical base tickers to scan (e.g., 'BTC', 'ETH', 'SOL', 'XRP', 'DOGE', 'SUI', 'PEPE', 'HYPE'). Automatically matches scaled contracts such as kPEPE / 1000PEPE and XBT. Leave empty to scan all active perpetuals.

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

Upper cap on total records pushed to the dataset (protects user budget under Pay-Per-Event billing). Default 60 returns a rich mix of carry signals, anomalies, and liquid perp markets.

## `minOpenInterestUsd` (type: `number`):

Minimum open interest in USD required on each perpetual contract leg to qualify for cross-venue carry arbitrage, extreme anomalies, and market snapshots.

## `minVolume24hUsd` (type: `number`):

Filter out inactive perpetual contracts with 24-hour USD trading volume below this floor.

## `holdingDays` (type: `number`):

Holding period (in days) over which 4-fill entry+exit taker fees across both legs (Hyperliquid 3.5 bps, dYdX 5 bps, Kraken 5 bps, OKX 5 bps) are amortized to compute net_carry_apr_pct.

## `minGrossSpreadAprPct` (type: `number`):

Minimum gross annualized funding rate differential (short_apr - long_apr) required to emit a cross-venue delta-neutral carry signal.

## `minNetCarryAprPct` (type: `number`):

Minimum net annualized carry APR after deducting round-trip taker fees over holdingDays. Set to 0 to keep only profitable post-fee carry trades at your target horizon.

## `extremeFundingAprPct` (type: `number`):

Absolute annualized funding rate threshold (default 50% APR) used to flag extreme single-venue cash-and-carry (spot + perp) opportunities.

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

Ordering applied to normalized perpetual market snapshot records.

## Actor input object example

```json
{
  "mode": "all",
  "venues": [
    "hyperliquid",
    "dydx",
    "kraken",
    "okx"
  ],
  "symbols": [],
  "maxResults": 60,
  "minOpenInterestUsd": 100000,
  "minVolume24hUsd": 25000,
  "holdingDays": 7,
  "minGrossSpreadAprPct": 5,
  "minNetCarryAprPct": 0,
  "extremeFundingAprPct": 50,
  "sortBy": "open_interest_usd"
}
```

# Actor output Schema

## `overviewTable` (type: `string`):

Unified overview combining cross-venue delta-neutral carry pairs, extreme single-venue funding anomalies, and normalized perpetual snapshots.

## `carryArbitrageView` (type: `string`):

Fee-adjusted short/long venue pairs ranked by net carry APR, breakeven hours, deployable capacity, and basis convergence bonus.

## `marketsView` (type: `string`):

Standardized 1h/8h/APR funding rates, mark-index basis (bps), open interest (USD), and 24h volume across Hyperliquid, dYdX v4, Kraken Futures, and OKX.

## `rawDataset` (type: `string`):

Complete unprojected JSON records ready for automated trading bots, quant research pipelines, and AI Agents via MCP.

## `executiveSummary` (type: `string`):

Venue ingestion counts, top carry arbitrage highlights, HTTP latency stats, and Pay-Per-Event billing ledger.

# 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 = {
    "venues": [
        "hyperliquid",
        "dydx",
        "kraken",
        "okx"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("conscious_chuckwalla/crypto-funding-rate-carry-arb").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 = { "venues": [
        "hyperliquid",
        "dydx",
        "kraken",
        "okx",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("conscious_chuckwalla/crypto-funding-rate-carry-arb").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 '{
  "venues": [
    "hyperliquid",
    "dydx",
    "kraken",
    "okx"
  ]
}' |
apify call conscious_chuckwalla/crypto-funding-rate-carry-arb --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,conscious_chuckwalla/crypto-funding-rate-carry-arb"
        }
    }
}
```

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/SF09iIjC8j5GscnMf/builds/RdC9HmhaA7j2oJhAv/openapi.json
