ccxt-php
Qué hace
Esta skill es una guía para crear funciones de exchanges de criptomonedas en proyectos PHP con la biblioteca CCXT. Es para desarrolladores que crean bots de trading o herramientas web en PHP.
Cuándo usarla
- ✓Cuando estás creando una app PHP que lee precios de criptomonedas de un exchange.
- ✓Cuando necesitas colocar órdenes desde un bot de trading en PHP.
- ✓Cuando quieres actualizaciones de ticker en directo en un proyecto PHP.
Link de la skill
https://github.com/ccxt/ccxt/blob/master/.claude/skills/ccxt-php/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Escribe un script en PHP que muestre el ticker de BTC/USDT de Binance.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
La IA instala el paquete CCXT con Composer, crea un objeto de exchange y llama al método correspondiente en estilo síncrono o asíncrono.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
CCXT for PHP
A comprehensive guide to using CCXT in PHP projects for cryptocurrency exchange integration.
Installation
Via Composer (REST and WebSocket)
composer require ccxt/ccxt
Required PHP Extensions
- cURL
- mbstring (UTF-8)
- PCRE
- iconv
- gmp (for some exchanges)
Optional for Async/WebSocket
- ReactPHP (installed automatically with ccxt)
Quick Start
REST API - Synchronous
<?php
date_default_timezone_set('UTC'); // Required!
require_once 'vendor/autoload.php';
$exchange = new \ccxt\binance();
$exchange->load_markets();
$ticker = $exchange->fetch_ticker('BTC/USDT');
print_r($ticker);
REST API - Asynchronous (ReactPHP)
<?php
use function React\Async\await;
date_default_timezone_set('UTC');
require_once 'vendor/autoload.php';
$exchange = new \ccxt\async\binance();
$ticker = await($exchange->fetch_ticker('BTC/USDT'));
print_r($ticker);
WebSocket API - Real-time Updates
<?php
use function React\Async\await;
use function React\Async\async;
date_default_timezone_set('UTC');
require_once 'vendor/autoload.php';
$exchange = new \ccxt\pro\binance();
while (true) {
$ticker = await($exchange->watch_ticker('BTC/USDT'));
print_r($ticker); // Live updates!
}
await($exchange->close());
REST vs WebSocket
| Mode | REST | WebSocket |
|---|---|---|
| Sync | \ccxt\binance() |
(WebSocket requires async) |
| Async | \ccxt\async\binance() |
\ccxt\pro\binance() |
| Feature | REST API | WebSocket API |
|---|---|---|
| Use for | One-time queries, placing orders | Real-time monitoring, live price feeds |
| Method prefix | fetch_* (fetch_ticker, fetch_order_book) |
watch_* (watch_ticker, watch_order_book) |
| Speed | Slower (HTTP request/response) | Faster (persistent connection) |
| Rate limits | Strict (1-2 req/sec) | More lenient (continuous stream) |
| Best for | Trading, account management | Price monitoring, arbitrage detection |
Creating Exchange Instance
REST API - Synchronous
<?php
date_default_timezone_set('UTC');
require_once 'vendor/autoload.php';
// Public API (no authentication)
$exchange = new \ccxt\binance([
'enableRateLimit' => true // Recommended!
]);
// Private API (with authentication)
$exchange = new \ccxt\binance([
'apiKey' => 'YOUR_API_KEY',
'secret' => 'YOUR_SECRET',
'enableRateLimit' => true
]);
REST API - Asynchronous
<?php
use function React\Async\await;
$exchange = new \ccxt\async\binance([
'enableRateLimit' => true
]);
$ticker = await($exchange->fetch_ticker('BTC/USDT'));
WebSocket API
<?php
use function React\Async\await;
// Public WebSocket
$exchange = new \ccxt\pro\binance();
// Private WebSocket (with authentication)
$exchange = new \ccxt\pro\binance([
'apiKey' => 'YOUR_API_KEY',
'secret' => 'YOUR_SECRET'
]);
// Always close when done
await($exchange->close());
Common REST Operations
Loading Markets
// Load all available trading pairs
$exchange->load_markets();
// Access market information
$btc_market = $exchange->market('BTC/USDT');
print_r($btc_market['limits']['amount']['min']); // Minimum order amount
Fetching Ticker
// Single ticker
$ticker = $exchange->fetch_ticker('BTC/USDT');
print_r($ticker['last']); // Last price
print_r($ticker['bid']); // Best bid
print_r($ticker['ask']); // Best ask
print_r($ticker['volume']); // 24h volume
// Multiple tickers (if supported)
$tickers = $exchange->fetch_tickers(['BTC/USDT', 'ETH/USDT']);
Fetching Order Book
// Full orderbook
$orderbook = $exchange->fetch_order_book('BTC/USDT');
print_r($orderbook['bids'][0]); // [price, amount]
print_r($orderbook['asks'][0]); // [price, amount]
// Limited depth
$orderbook = $exchange->fetch_order_book('BTC/USDT', 5); // Top 5 levels
Creating Orders
Limit Order
// Buy limit order
$order = $exchange->create_limit_buy_order('BTC/USDT', 0.01, 50000);
print_r($order['id']);
// Sell limit order
$order = $exchange->create_limit_sell_order('BTC/USDT', 0.01, 60000);
// Generic limit order
$order = $exchange->create_order('BTC/USDT', 'limit', 'buy', 0.01, 50000);
Market Order
// Buy market order
$order = $exchange->create_market_buy_order('BTC/USDT', 0.01);
// Sell market order
$order = $exchange->create_market_sell_order('BTC/USDT', 0.01);
// Generic ma
Preguntas frecuentes
¿Cómo se instala?
La skill dice que hay que ejecutar composer require ccxt/ccxt en el proyecto.
¿Qué extensiones de PHP se necesitan?
La skill enumera cURL, mbstring, PCRE, iconv y gmp para algunos exchanges.
¿Necesita una configuración de zona horaria?
Sí. La skill dice que hay que definir la zona horaria por defecto como UTC antes de cargar la biblioteca.
Detalles
Descripción original del autor
CCXT cryptocurrency exchange library for PHP developers. Covers both REST API (standard) and WebSocket API (real-time). Helps install CCXT, connect to exchanges, fetch market data, place orders, stream live tickers/orderbooks, handle authentication, and manage errors in PHP 8.1+. Use when working with crypto exchanges in PHP projects, trading bots, or web applications. Supports both sync and async (ReactPHP) usage.
repo: ccxt/ccxt
Popularidad
- Estrellas en GitHub
- 45 mil
- Posición en el ranking
- #6384
- Licencia
- MIT
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
binance-agentic-wallet
45 milPermite que tu agente gestione una billetera Web3 de Binance mediante la línea de comandos baw, incluidos el inicio de sesión, los saldos, las transferencias, los intercambios de tokens y las órdenes límite.
binance-sports-ai-analyzer
45 milAyuda a tu agente a consultar predicciones de partidos del Mundial, análisis con IA y perspectivas de noticias, y a recalcular las probabilidades de victoria cuando cambias las señales.
binance-tokenized-securities-info
45 milPermite que tu agente consulte las acciones estadounidenses tokenizadas de Ondo en Binance Web3, incluyendo listas de tokens, información de empresas, estado de negociación y precios en cadena.
binance
45 milPermite que tu agente use Binance Spot, USD-M Futures y Convert mediante la herramienta binance-cli. Requiere que primero configures la autenticación.
Skills parecidas
api-connector-builder
280 milHace que tu agente cree nuevas conexiones de API siguiendo el patrón existente. Úsalo para añadir una integración más sin inventar otra forma de hacer las cosas.
api-design
280 milAyuda a tu agente a diseñar APIs REST según las buenas prácticas. Es útil para definir cómo se comunican las APIs, cómo se muestran los errores y cómo organizar los datos.
backend-patterns
280 milAyuda a tu agente con patrones de arquitectura del lado del servidor y optimización de bases de datos. Es útil para crear o revisar código que se ejecuta en el servidor.