본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)45k · #6384

ccxt-php

하는 일

CCXT 라이브러리로 PHP 프로젝트에서 암호화폐 거래소 기능을 만드는 안내서입니다. PHP로 트레이딩 봇이나 웹 도구를 만드는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓거래소에서 암호화폐 가격을 읽는 PHP 앱을 만들 때.
  • ✓PHP 트레이딩 봇에서 주문을 넣어야 할 때.
  • ✓PHP 프로젝트에 실시간 티커 업데이트가 필요한 경우.

스킬 링크

https://github.com/ccxt/ccxt/blob/master/.claude/skills/ccxt-php/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/ccxt/ccxt/blob/master/.claude/skills/ccxt-php/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Binance에서 BTC/USDT 티커를 출력하는 PHP 스크립트를 작성해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 Composer로 CCXT 패키지를 설치하고, 거래소 객체를 만든 뒤, 동기 또는 비동기 방식으로 맞는 메서드를 호출합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
자주 묻는 질문

어떻게 설치하나요?

프로젝트에서 composer require ccxt/ccxt를 실행하라고 스킬이 말합니다.

어떤 PHP 확장이 필요한가요?

일부 거래소를 위해 cURL, mbstring, PCRE, iconv, gmp를 나열합니다.

시간대 설정이 필요한가요?

예. 라이브러리를 불러오기 전에 기본 시간대를 UTC로 설정하라고 스킬이 말합니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
45k
순위
#6384
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬