WEEX and CCXT: Compatibility and Python Setup

By: WEEX
|
0

WEEX and CCXT: Compatibility and Python Setup

Yes. CCXT includes a weex implementation for WEEX spot and perpetual swap markets. In Python, you can create a client with ccxt.weex(). If you already use CCXT with another exchange, familiar market-data, account and order methods provide a starting point for the integration.

The next step is to check whether your installed version supports the methods your strategy needs and which markets those methods cover. With that established, you can configure credentials and trading parameters for WEEX.

Check the market type and method coverage first

The WEEX implementation in CCXT lists capabilities through its has flags. At the time of verification, the main entries were:

CapabilityFlag in the checked source
Spot and perpetual swapsSupported through spot and swap
Tickers, order books, candles and balancesCommon methods marked as supported
Single-order creation, cancellation and open-order queriesMarked as supported, subject to product and parameter requirements
createOrders, editOrder and withdrawMarked as unsupported

CCXT classifies perpetual contracts as swap. A future: False entry in the same implementation therefore does not mean WEEX perpetuals are unavailable. Check swap and the relevant market information.

A common method name does not guarantee identical behavior across spot and contracts. Some historical-order methods, for example, have product restrictions. Check each method your strategy uses in the version you plan to deploy.

Start with a public market-data request

Install CCXT:

python -m pip install ccxt

This example loads the market list and then queries a spot ticker. It needs no API key and does not place an order:

import ccxt

exchange = ccxt.weex({"enableRateLimit": True})
markets = exchange.load_markets()
symbol = "BTC/USDT"

if symbol not in markets:
    raise ValueError("Check the available WEEX markets first")
if not exchange.has.get("fetchTicker"):
    raise NotImplementedError("fetchTicker is unavailable in this version")

ticker = exchange.fetch_ticker(symbol)
print(ticker["symbol"], ticker["last"])

Calling load_markets() first confirms that the symbol is available before another method uses it. Typical CCXT unified symbols are BTC/USDT for spot and BTC/USDT:USDT for a USDT-settled perpetual. Do not assume the raw WEEX symbol BTCUSDT can be passed to every unified CCXT method.

If Python reports that CCXT has no weex attribute, check the installed version, the active Python environment and whether a local file named ccxt.py is shadowing the library.

Where does the WEEX passphrase go?

The three WEEX credentials map to apiKey, secret and password in CCXT. The password field takes the API passphrase, not your WEEX login password. It is worth checking this mapping explicitly when private requests fail.

Read credentials from server-side environment variables or a secrets manager. Use read-only access for account monitoring. For trading, configure the relevant permissions using the spot preparation guide or futures preparation guide.

Once public market data works, validate an authorized private read. This sequence makes it easier to separate network or market-configuration problems from authentication and permission errors.

What should I check before running a strategy?

A successful public query is a useful starting point. Trading also requires checks for order types, price precision, quantity limits and contract-specific parameters. Working single-order calls do not replace a separate check for batch-order support.

Keep enableRateLimit enabled and account for IP and account budgets shared by multiple processes. Local throttling controls the client's pace; the exchange still applies its own limits. If an order request times out, query its status before deciding whether to retry.

For live data, explore the WEEX streaming interfaces under ccxt.pro and check your version's watch_* capabilities. After reconnection, reconcile order state across the interruption. Once validation is complete, pin the tested CCXT version and retest the methods your strategy uses when upgrading.

Should I choose CCXT or the official WEEX Python SDK?

CCXT's unified methods are useful when an application connects to several exchanges and reuses code across them. If your work centers on WEEX, you can also evaluate the Python Connector published by WEEX's official organization. Compare the endpoints you need, your dependencies and how you intend to maintain the integration.

CCXT is a third-party framework, separate from the official WEEX SDK. For newer endpoints missing from your version, investigate implicit methods or direct REST calls, checking support for each required operation.

Related articles
Share
copy

Gainers

iconiconiconiconiconiconiconiconicon
Customer Support:@weikecs
Business Cooperation:@weikecs
Quant Trading & MM:bd@weex.com
VIP Program:support@weex.com