本文へスキップ
Skillpedia
APIとサーバー(バックエンド)45k · #6382

ccxt-java

できること

このスキルは、CCXTライブラリを使ってJavaアプリケーションで暗号資産の取引所の機能を作るためのガイドです。Javaで取引システムや金融ソフトウェアを作る開発者向けです。

使う場面

  • ✓取引所から暗号資産の価格を読むJavaのアプリを作っているとき。
  • ✓Javaの取引システムから注文を出す必要があるとき。
  • ✓Javaプロジェクトで、ライブのティッカーの更新がほしいとき。

スキルのリンク

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

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/ccxt/ccxt/blob/master/.claude/skills/ccxt-java/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“KrakenからETH/USDTの現在価格を表示するJavaのクラスを書いてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

AIは、CCXTのJavaパッケージを使い、型付きの取引所クラスを作ります。作業に応じて、RESTまたはWebSocketのメソッドを呼び出します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

CCXT for Java

A comprehensive guide to using CCXT in Java projects for cryptocurrency exchange integration.

Installation

Via Gradle

// build.gradle
repositories {
    mavenCentral()
}
dependencies {
    implementation 'io.github.ccxt:ccxt:latest.release'
}

Via Maven

<dependency>
    <groupId>io.github.ccxt</groupId>
    <artifactId>ccxt</artifactId>
    <version>LATEST</version>
</dependency>

Requirements

  • Java 21 or higher (uses virtual threads)

Quick Start

REST API

import io.github.ccxt.exchanges.Binance;
import io.github.ccxt.types.Ticker;

Binance exchange = new Binance();
exchange.loadMarkets(false);
Ticker ticker = exchange.fetchTicker("BTC/USDT");
System.out.println(ticker.last);

WebSocket API - Real-time Updates

import io.github.ccxt.exchanges.pro.Binance;

var exchange = new Binance();
exchange.loadMarkets(false);
while (true) {
    Ticker ticker = exchange.watchTicker("BTC/USDT"); // typed sync, blocks for one update
    System.out.println(ticker.last);
}

Architecture: Typed Subclasses

Each exchange has two classes following the Go pattern:

  • BinanceCore - transpiled untyped class (internal, extends BinanceApi extends Exchange)
  • Binance - typed wrapper extending Core with typed overloads (user-facing)
// User-facing typed class (recommended)
Binance exchange = new Binance();
Ticker ticker = exchange.fetchTicker("BTC/USDT");       // returns Ticker
List<Trade> trades = exchange.fetchTrades("BTC/USDT");   // returns List<Trade>

// Exchange-specific implicit API methods are also accessible
Object raw = exchange.publicGetTicker24hr(params).join(); // Binance-specific endpoint

// Properties accessible directly
exchange.apiKey = "...";
exchange.secret = "...";

The typed methods use Java method overloading. They coexist safely with untyped methods because Java resolves overloads at compile time: BinanceCore.java is compiled without knowledge of Binance.java's typed overloads, so internal calls always bind to untyped varargs.

REST vs WebSocket

Feature REST API WebSocket API
Use for One-time queries, placing orders Real-time monitoring, live price feeds
Import io.github.ccxt.exchanges.Binance io.github.ccxt.exchanges.pro.Binance
Methods fetch* (fetchTicker, fetchOrderBook) watch* (watchTicker, watchOrderBook)
Returns Typed objects (Ticker, List<Trade>) CompletableFuture<Object> (call .join())
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

import io.github.ccxt.exchanges.Binance;
import java.util.Map;
import java.util.HashMap;

// Public API (no authentication)
Binance exchange = new Binance();

// Private API (with authentication)
Map<String, Object> config = new HashMap<>();
config.put("apiKey", "YOUR_API_KEY");
config.put("secret", "YOUR_SECRET");
Binance exchange = new Binance(config);

WebSocket API

import io.github.ccxt.exchanges.pro.Binance;

// Public WebSocket
var exchange = new Binance();

// Private WebSocket (with authentication)
Map<String, Object> config = new HashMap<>();
config.put("apiKey", "YOUR_API_KEY");
config.put("secret", "YOUR_SECRET");
var exchange = new Binance(config);

Dynamic Instantiation (generic, untyped)

import io.github.ccxt.Exchange;

// Returns Exchange type - no typed methods, but works for any exchange
Exchange exchange = Exchange.dynamicallyCreateInstance("binance", config);
Object ticker = exchange.fetchTicker("BTC/USDT").join(); // untyped, returns CompletableFuture

Common REST Operations

Loading Markets

// Load all available trading pairs (typed)
Map<String, MarketInterface> markets = exchange.loadMarkets(false);

// Access market information
MarketInterface btcMarket = markets.get("BTC/USDT");
System.out.println(btcMarket.base);    // "BTC"
System.out.println(btcMarket.quote);   // "USDT"
System.out.println(btcMarket.active);  // true

Fetching Ticker

// Single ticker (typed)
Ticker ticker = exchange.fetchTicker("BTC/USDT");
System.out.println(ticker.last);      // Last price
System.out.println(ticker.bid);       // Best bid
System
よくある質問

必要なJavaのバージョンは何ですか?

スキルによると、仮想スレッドを使うため、Java 21以上が必要です。

プロジェクトにライブラリをどう追加しますか?

スキルは、GradleとMavenの設定の例を示しています。

型付きの取引所クラスとは何ですか?

各取引所には型付きのクラスがあり、汎用のデータではなく、名前付きの戻り値の型をコードに与えると、スキルは説明しています。

詳細

作者による元の説明

CCXT cryptocurrency exchange library for Java 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 Java projects. Use when working with crypto exchanges in Java applications, trading systems, or financial software. Requires Java 21+.

repo: ccxt/ccxt

人気

GitHubのスター
45k
ランキング
#6382
ライセンス
MIT
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル