Nouvelle intégration d'échange CCXT

VérifiéSûr

Scaffolding d'une nouvelle intégration d'échange dans CCXT en TypeScript : méthodes unifiées, parsers, flags de capacité, sandbox et fixtures.

Spar Skills Guide Bot
DeveloppementAvancé
29/08/2026
Claude CodeCursorCodex
#ccxt#exchange-api#typescript#scaffolding#crypto

Recommandé pour

Synthèse automatique

Génère le squelette d'une nouvelle intégration d'exchange CCXT en TypeScript en suivant le modèle des exchanges certifiés : describe(), méthodes unifiées, parseurs, drapeaux de capacités, sandbox et fixtures.

Points forts

  • Fournit un tableau de correspondance pour choisir un exchange de référence selon le style (spot, futures, dérivés, on-chain, WebSocket) au lieu de partir de zéro.
  • Donne un squelette concret de describe() avec les drapeaux 'has', les URLs publiques/privées et la structure testnet optionnelle.
  • Oriente explicitement vers les documents obligatoires du dépôt (wiki/Requirements.md, CONTRIBUTING.md) et les règles du transpileur.
  • Couvre à la fois le module REST ts/src/<id>.ts et le module optionnel pro/<id>.ts pour le WebSocket.

Limites

  • N'a de sens qu'à l'intérieur du monorepo CCXT : il dépend des chemins ts/src/, wiki/Requirements.md et des exchanges de référence cités.
  • Suppose une bonne connaissance préalable de l'API unifiée CCXT et des conventions du projet ; peu d'explications de fond sur les parseurs.
  • Le contenu fourni s'interrompt au milieu du squelette et n'inclut pas d'étape de validation ou de lancement des tests après génération.
Quand l'utiliser

À utiliser lorsqu'on ajoute un exchange totalement nouveau (nouvel identifiant sous ts/src/) au dépôt CCXT en TypeScript.

Quand l'éviter

À éviter pour corriger un exchange existant, ajouter une méthode à une intégration déjà certifiée, ou travailler en dehors du dépôt CCXT.

Analyse de sécurité

Sûr
Score qualité88/100

This is a developer-workflow guide for scaffolding a new CCXT exchange integration. It only references ordinary build/test tooling (npm run lint/transpile, node cli.js, run-tests) and legitimate live smoke tests against exchange public APIs. There are no destructive commands, no credential exfiltration, no obfuscated payloads, no safety-disabling instructions, and no embedded prompt-injection attempts; placeholders like https://<id>.com are template stubs, not real endpoints.

Aucun point d'attention détecté

Comment cette analyse est faite

Exemples

Scaffold a spot exchange
Scaffold a new CCXT exchange 'acme' (Acme Exchange) in ts/src/acme.ts. It is spot-only, REST API at https://api.acme.com, docs at https://docs.acme.com, and it has a testnet at https://testnet.acme.com. Use ts/src/kraken.ts as the reference and start with all 'has' flags false except the essentials.
Futures-focused integration
Create the skeleton for a derivatives exchange 'delta' in ts/src/delta.ts based on ts/src/bybit.ts, with swap and future enabled, spot disabled, and the sandbox URLs wired to its demo environment.
Add WebSocket support
My new exchange 'acme' already has a REST module in ts/src/acme.ts. Scaffold the optional WebSocket layer in ts/src/pro/acme.ts following ts/src/pro/binance.ts, and tell me which 'pro' and 'has' flags to flip.

name: new-exchange description: Scaffold a new CCXT exchange integration in TypeScript, following the certified-exchange template. Walks through describe(), required unified methods, parsers, capability flags, sandbox setup, and static fixtures. Use when adding support for an exchange that does not exist yet under ts/src/.

New Exchange Integration

Scaffold a new exchange in ts/src/<id>.ts (REST) and optionally ts/src/pro/<id>.ts (WebSocket).

Read first: wiki/Requirements.md (mandatory unified methods) and CONTRIBUTING.md (transpiler rules). The CCXT root CLAUDE.md is the contributor guide.

Inputs

  • <id>: lowercase exchange id, no separators (e.g. mynewex)
  • <Name>: human-readable name (e.g. My New Exchange)
  • API docs URL(s)
  • Whether the exchange has a testnet/sandbox

Step 1 — Pick a reference exchange

Don't write from scratch. Copy a similar exchange that's already certified and adapt it.

| Style | Reference | |---|---| | Spot + futures, signed REST | ts/src/binance.ts, ts/src/okx.ts | | Spot only | ts/src/kraken.ts, ts/src/coinbase.ts | | Derivatives focus | ts/src/bybit.ts, ts/src/bitmex.ts | | Decentralised / on-chain signing | ts/src/hyperliquid.ts, ts/src/dydx.ts | | WebSocket reference | ts/src/pro/binance.ts, ts/src/pro/okx.ts |

Open the reference next to your new file and pattern-match — never invent new conventions.

Step 2 — Create ts/src/<id>.ts

Skeleton:

import Exchange from './abstract/<id>.js';
import { /* errors needed */ } from './base/errors.js';
import { Precise } from './base/Precise.js';
import type { /* types needed */ } from './base/types.js';

export default class <id> extends Exchange {
    describe (): any {
        return this.deepExtend (super.describe (), {
            'id': '<id>',
            'name': '<Name>',
            'countries': [ 'XX' ],
            'rateLimit': 1000,        // ms between requests
            'version': 'v1',
            'certified': false,
            'pro': false,             // flip to true when pro/<id>.ts exists
            'has': {
                // start everything false; flip to true as you implement
                'CORS': undefined,
                'spot': true,
                'margin': false,
                'swap': false,
                'future': false,
                'option': false,
                'fetchMarkets': true,
                'fetchCurrencies': true,
                'fetchTicker': true,
                'fetchTickers': false,
                'fetchOrderBook': true,
                'fetchTrades': true,
                'fetchOHLCV': false,
                'fetchBalance': true,
                'createOrder': true,
                'cancelOrder': true,
                'fetchOrder': true,
                'fetchOpenOrders': true,
                'fetchOrders': false,
                'fetchClosedOrders': false,
                'fetchMyTrades': true,
                'fetchDeposits': false,
                'fetchWithdrawals': false,
                'withdraw': false,
            },
            'urls': {
                'logo': 'https://...',
                'api': {
                    'public': 'https://api.<id>.com',
                    'private': 'https://api.<id>.com',
                },
                'test': {                              // OPTIONAL — only if testnet exists
                    'public': 'https://testnet.<id>.com',
                    'private': 'https://testnet.<id>.com',
                },
                'www': 'https://<id>.com',
                'doc': [ 'https://docs.<id>.com' ],
                'fees': 'https://<id>.com/fees',
            },
            'api': {
                'public': {
                    'get': [
                        'symbols',
                        'ticker/{pair}',
                        'orderbook/{pair}',
                    ],
                },
                'private': {
                    'get': [ 'account', 'orders' ],
                    'post': [ 'order' ],
                    'delete': [ 'order/{id}' ],
                },
            },
            'requiredCredentials': {
                'apiKey': true,
                'secret': true,
                // 'password': true,        // for passphrase-based exchanges
                // 'walletAddress': true,   // for on-chain
                // 'privateKey': true,
            },
            'fees': {
                'trading': {
                    'tierBased': false,
                    'percentage': true,
                    'maker': 0.001,
                    'taker': 0.001,
                },
            },
            'precisionMode': /* TICK_SIZE | DECIMAL_PLACES | SIGNIFICANT_DIGITS */,
            'options': {
                // exchange-specific defaults
            },
            'exceptions': {
                'exact': {
                    // 'ERROR_CODE': BadRequest,
                },
                'broad': {
                    // 'invalid signature': AuthenticationError,
                },
            },
        });
    }

    // implement the unified methods you flipped on in `has`
    async fetchMarkets (params = {}): Promise<Market[]> { /* ... */ }
    parseMarket (market: Dict): Market { /* ... */ }
    async fetchTicker (symbol: string, params = {}): Promise<Ticker> { /* ... */ }
    parseTicker (ticker: Dict, market: Market = undefined): Ticker { /* ... */ }
    // ...

    sign (path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
        // build URL, sign request — use this.hmac, this.jwt, this.ecdsa, never external libs
    }

    handleErrors (httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody) {
        // throw the right exception based on response
    }
}

Step 3 — Define implicit API methods

URLs in the api block become methods automatically:

  • 'symbols' → this.publicGetSymbols(params)
  • 'ticker/{pair}' → this.publicGetTickerPair({ pair: market['id'] })
  • 'orders' under private.get → this.privateGetOrders(params)

Don't write explicit HTTP wrappers. After listing the URL in api, run npm run emitAPITs to regenerate ts/src/abstract/<id>.ts (the auto-typed declarations).

Step 4 — Docstrings on every public method

Every public method needs a JSDoc block. The transpilers convert it to native docstrings in Python/PHP/C#/Go, and npm run build-docs produces wiki entries from them. Pattern:

/**
 * @method
 * @name <id>#fetchMyTrades
 * @description fetches all completed trades made by the user
 * @see https://docs.<id>.com/api/trades                 // spot
 * @see https://docs.<id>.com/api/derivatives/trades     // swap
 * @param {string} symbol unified market symbol
 * @param {int} [since] earliest timestamp in ms
 * @param {int} [limit] maximum number of trades to return
 * @param {object} [params] extra parameters specific to the exchange API endpoint
 * @param {int} [params.until] latest timestamp in ms
 * @returns {object[]} a list of [trade structures](https://docs.ccxt.com/#/?id=trade-structure)
 */
async fetchMyTrades (symbol: Str = undefined, since: Int = undefined, limit: Int = undefined, params = {}): Promise<Trade[]> {
    // ...
}

Rules: lowercase @description, @param {object} [params] always present, document every params.<key> you read in the body, link @returns to the manual structure. See CLAUDE.md §7 for the full ruleset.

Step 5 — Required parsers

For every fetch method, write a matching parser. The parser is what makes output uniform across all exchanges:

| Fetch method | Parser | Validator (test) | |---|---|---| | fetchMarkets | parseMarket | ts/src/test/Exchange/base/test.market.ts | | fetchCurrencies | parseCurrency | test.currency.ts | | fetchTicker | parseTicker | test.ticker.ts | | fetchOrderBook | base parseOrderBook | test.orderBook.ts | | fetchTrades, fetchMyTrades | parseTrade | test.trade.ts | | fetchOHLCV | parseOHLCV | test.ohlcv.ts | | fetchBalance | parseBalance | test.balance.ts | | createOrder, fetchOrder, fetchOpenOrders | parseOrder | test.order.ts | | fetchPositions | parsePosition | test.position.ts |

Parsing rules (also in CLAUDE.md §7):

  • Always safeString first, parse with Precise for math, finalise with parseNumber only at the return.
  • Symbol resolution: this.safeSymbol(marketId, market) — never put exchange-specific ids into unified output.
  • Time: convert seconds → ms using safeTimestamp; everything in unified output is ms.

Step 6 — Static fixtures (TDD)

Capture a request/response fixture as soon as a method works once. Re-run on every change.

# request fixture (URL/body assertion) — NO HTTP
node cli.js <id> fetchTicker BTC/USDT --report
# response fixture (parser assertion) — NO HTTP
node cli.js <id> fetchTicker BTC/USDT --response

Paste each methods.<methodName> entry into ts/src/test/static/request/<id>.json or ts/src/test/static/response/<id>.json. Then run:

npm run request-tests
npm run response-tests

These tests run in all five languages and are your primary regression net.

Step 7 — Verify in all languages

A new exchange means thousands of new lines in Python, PHP, C#, Go and Java. The transpilers must like all of it.

npm run lint
npm run tsBuild
npm run transpile          # → Python, PHP
npm run transpileCS        # → C#
npm run buildCS
npm run transpileGO        # → Go
npm run buildGO
npm run check-python-syntax
npm run check-php-syntax
npm run id-tests
npm run request-tests
npm run response-tests

Then a live smoke test on at least one public method per language:

npm run cli.ts -- <id> fetchTicker BTC/USDT --verbose
npm run cli.py -- <id> fetchTicker BTC/USDT --verbose
npm run cli.php -- <id> fetchTicker BTC/USDT --verbose
npm run cli.cs -- <id> fetchTicker BTC/USDT --verbose
npm run cli.go -- <id> fetchTicker BTC/USDT --verbose

Step 8 — WebSocket support (optional)

If the exchange has WS, create ts/src/pro/<id>.ts. It must extends <id>Rest and add watch* methods. Reference: ts/src/pro/binance.ts. Flip 'pro': true in REST describe().

Step 9 — Update user-facing docs

A new exchange means new public surface area. Update the touchpoints listed in CLAUDE.md §8:

  • wiki/Manual.md doesn't usually list per-exchange specifics, but add a section if your exchange introduces a new pattern (e.g. a new auth scheme, new params).
  • Verify examples/ts/<id>-example.ts has at least one runnable snippet (transpiled to other languages by npm run tsBuildExamples).
  • The end-user skills under .claude/skills/ccxt-{typescript,python,php,csharp,go}/ mention "all 100+ exchanges" — usually no edit needed unless your exchange has unique credential requirements (e.g. wallet/private key) worth calling out.
  • npm run build-docs regenerates wiki entries from your JSDoc — run it once and inspect the output.

Step 10 — PR

Title: feat(<id>): add <Name> integration. Description follows the template in CLAUDE.md §11 — list every test you ran with results, and reference any related issue/PR.

Output checklist

  • [ ] ts/src/<id>.ts written (uses Precise, safeString*, safeSymbol)
  • [ ] Every public method has a JSDoc block (CLAUDE.md §7)
  • [ ] 'has' flags accurately reflect implemented methods
  • [ ] 'urls.test' set if exchange has a testnet
  • [ ] 'requiredCredentials' matches what sign() actually uses
  • [ ] All required parsers (parseMarket, parseTicker, parseTrade, parseOrder, …)
  • [ ] handleErrors maps exchange error codes to CCXT exception classes
  • [ ] ts/src/abstract/<id>.ts regenerated via npm run emitAPITs
  • [ ] Static request + response fixtures for every implemented method
  • [ ] npm run lint && npm run tsBuild && npm run transpile && npm run transpileCS && npm run transpileGO all pass
  • [ ] npm run id-tests && npm run request-tests && npm run response-tests all pass
  • [ ] Live smoke tested in TS + at least one transpiled language (cli.py, cli.cs, cli.go, …) with --verbose
  • [ ] npm run build-docs ran, generated wiki entries look correct
  • [ ] User-facing docs reviewed (CLAUDE.md §8) — Manual.md / examples / language skills if anything is non-standard
  • [ ] PR title follows feat(<id>): ...; description fills CLAUDE.md §11 template

Prediction-market exchange variant

A prediction-market venue (Polymarket-style: events → markets → binary/categorical outcomes) does not extend Exchange — it lives in its own namespace. The differences from the checklist above:

  1. File — ts/src/prediction/<id>.ts, class <id> extends PredictionExchange (import Exchange from ./abstract/prediction/<id>.js). Read .claude/rules/prediction-outcomes.md for the outcome-cache contract and ts/src/base/PredictionExchange.ts for the base helpers you inherit (loadOutcome/loadOutcomes/fetchOutcome/populateOutcomes/indexMarketOutcomes/safeOutcome/outcome, setEvents/getEvent/eventsList/applyEventFetchParams, parsePredictionTrades/parsePredictionOrders/parsePredictionPositions, safePrediction*).
  2. describe() — has.prediction: true; address methods by an outcome handle, not a symbol. Implement fetchEvents(params) (scope-required via requireEventQuery) and, if the venue has a single-event endpoint, fetchEvent(id). Return Prediction* types from ts/src/base/types.ts (never base Ticker/Order/…). loadAllOutcomes defaults to false (a cache miss resolves one outcome via the base search-backed fetchOutcome); override fetchOutcome with a by-id fetch when the venue has one (see kalshi), and set loadAllOutcomes: true only when the whole universe is a single cheap request (see hyperliquid). No-arg fetchTickers() must throw ArgumentsRequired unless the venue has a true all-tickers endpoint.
  3. Never call the base parseTrades/parseOrders/parsePositions — they filter by symbol and drop prediction rows. Use parsePredictionTrades/Orders/Positions. Never call buildOHLCVC (transpiles to a mangled name) — bucket candles inline.
  4. Registration — npm run export-exchanges adds the id to exchanges.json prediction[] and wires ts/ccxt.ts / the per-language namespaces / README table. npm run emitAPI emits ts/src/abstract/prediction/<id>.ts. Add a skip-tests.json entry with preferredEventQuery (the harness's fetchEvents scope) and preferredPredictionOutcome (a tradeable handle — validated against the live listing).
  5. Transpile — the scoped single-exchange transpilers auto-route a bare prediction-only id (tsx build/transpile.ts <id>, csharpTranspiler.ts <id>, goTranspiler.ts <id>). After editing PredictionExchange.ts you must also regen the base per language: tsx build/{transpile,csharpTranspiler,goTranspiler,javaTranspiler}.ts --baseClass. Any base→override call (like fetchOutcome) must be registered in VIRTUAL_BASE_METHODS in build/goTranspiler.ts or Go won't dispatch it.
  6. Test — node run-tests <id> --js --prediction --private (add --sandbox for demo hosts like kalshi). Static fixtures live in the normal flat ts/src/test/static/{request,response}/<id>.json; the python/php sync harness skips prediction (they carry "asyncOnly": true).

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/new-ccxt-exchange-integration-mte1lgj3/download' --output '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md.part' && mv '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md.part' '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md' && test -s '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/new-exchange' && cp -R '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3' '.claude/skills/new-exchange'

Cursor
test -f '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md' && test -s '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/new-exchange' && cp -R '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3' '.cursor/skills/new-exchange'

Codex
test -f '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md' && test -s '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/new-exchange' && cp -R '.skill-downloads/new-ccxt-exchange-integration-mte1lgj3' '.agents/skills/new-exchange'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/new-ccxt-exchange-integration-mte1lgj3'

openskills read 'new-ccxt-exchange-integration-mte1lgj3'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/new-ccxt-exchange-integration-mte1lgj3/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires