Type/to search
Built-in Functions
Structures
Built-in Variables and Constants
Conventions
Exchanges
Capability Matrix
Centralized Exchanges
AscendEx
Backpack
BigONE
Binance
Bitfinex
bitFlyer
Bitget
Bithumb
Bitstamp
Bybit
Coincheck
Coinone
CoinW
Crypto.com
DeepCoin
Deribit
DigiFinex
Gate
Gemini
HashKey
HitBTC
HTX
Korbit
Kraken
KuCoin
LBank
MEXC
OKX
Poloniex
Upbit
WEEX
WOO X
Zaif
Decentralized Exchanges (DEX)
Prediction Markets
Securities and Futures
On-chain & Custom

WEEX (Spot): WEEX spot trading over the WEEX spot V3 REST API (api-spot.weex.com). The API KEY configuration needs the Access Key, Secret Key and Passphrase. Spot only; use Futures_WEEX for perpetual contracts.

Futures_WEEX (Futures): WEEX USDT-margined perpetual contracts over the WEEX futures V3 REST API (api-contract.weex.com), with no delivery contracts. The API KEY configuration needs the Access Key, Secret Key and Passphrase. Native take-profit and stop-loss conditional orders are supported.

Names and Configuration
exchange.GetName()Type
WEEXSpot
Futures_WEEXFutures
FieldRequired
--
Access KeyYes
Secret KeyYes
PassphraseYes

Trading Pairs and Contract Codes
All exchange objects

Pair examples: BTC_USDT, ETH_USDT

WEEX (Spot)

Trading pairs are written BTC_USDT, matching the WEEX native code BTCUSDT. Symbols with a contract suffix are rejected.

Futures_WEEX (Futures)

Trading pairs are written BTC_USDT, matching the WEEX native code BTCUSDT; exchange.GetMarkets() lists the tradable contracts.

Contract codeDescription
swapPerpetual contract.

WEEX has no delivery contracts; other contract codes are rejected. Order amounts are in the base currency (the exchange does not accept orders in contracts; CtVal is 1 in exchange.GetMarkets()).

Function Support
WEEX (Spot)

Not supported (the call fails with an error and returns null): exchange.ModifyOrder, exchange.CreateConditionOrder, exchange.ModifyConditionOrder, exchange.CancelConditionOrder, exchange.GetConditionOrder, exchange.GetConditionOrders, exchange.GetHistoryConditionOrders.

Served through a fallback:

  • exchange.GetRecords: Native periods are 1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 1w; other periods are synthesized by the docker.
Futures_WEEX (Futures)

Not supported (the call fails with an error and returns null): exchange.ModifyOrder.

Served through a fallback:

  • exchange.GetRecords: Native periods are 1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d, 1w; other periods are synthesized by the docker.

Margin, Account and Simulation
Futures_WEEX (Futures)

Margin mode: There is no IO command for switching cross/isolated margin; the margin mode follows the contract's setting in the exchange account. exchange.SetMarginLevel() first reads the contract's current margin mode: under isolated margin it sets both the long and short leverage, under cross margin the cross leverage.

Position mode: Every order carries the position side positionSide, derived from the order direction: LONG for opening or closing long, SHORT for opening or closing short; positionSide can also be passed explicitly in the extra parameters. Conditional orders carry the position side too.

Notes
WEEX (Spot)
  • The amount of a market buy order is in the quote currency: the WEEX spot API cannot place market orders by amount, so the connector converts the amount into a base-currency quantity using the current asks (up to 200 levels, rounded down to the quantity step) before ordering; the filled amount may differ slightly from the amount passed. If the asks cannot absorb the amount, or the converted quantity is below the minimum order size, an error is reported instead of buying less. An explicit quantity in the extra parameters is used as is. When the order is queried, the Amount of a market buy order is the base-currency quantity recorded by the exchange.
  • Post-only (maker-only) orders are not supported; limit orders accept GTC, IOC and FOK only.
  • exchange.GetHistoryOrders() queries one trading pair only (the exchange's order history endpoint is per pair): without symbol it queries the current trading pair, and an empty string fails. The exchange looks back about 90 days only; a since older than that is queried from 90 days ago.
Futures_WEEX (Futures)
  • Conditional orders support take-profit and stop-loss only, not OCO (place the take-profit and stop-loss legs as two conditional orders).
  • exchange.ModifyConditionOrder() modifies the order in place through the exchange's modify endpoint, keeping the order ID; only untriggered take-profit and stop-loss conditional orders can be modified. The trigger price and order price can be changed: they are taken from TpTriggerPrice/TpOrderPrice or SlTriggerPrice/SlOrderPrice of condition according to the condition type, and an order price of -1 (or not greater than 0) switches to market execution after triggering. The exchange cannot change the amount or the side: if the amount or direction passed differs from the original order, an error is reported and a null value is returned rather than ignoring it. The trigger price type is kept from the original order (mark price or last price); triggerPriceType (CONTRACT_PRICE or MARK_PRICE) can also be passed in the extra parameters. Whether the modified order is a take-profit or a stop-loss is decided by the exchange from the new trigger price and may differ from ConditionType; check exchange.GetConditionOrder().
  • The exchange has no endpoint for querying a conditional order by ID, so exchange.GetConditionOrder() searches the active conditional orders and then the latest 20000 historical conditional orders, and fails when the order is not found.
  • exchange.GetHistoryOrders() and exchange.GetHistoryConditionOrders() look back about 90 days only; a since older than that is queried from 90 days ago.
  • The Rate of exchange.GetFundings() is the forecast funding rate of the next settlement and Time is the next settlement time; batch queries are supported (no symbol, or a range such as USDT.swap).
  • In exchange.GetTickers(), contracts without order book data (missing from the exchange's book ticker, for example a contract whose market is closed) have Buy and Sell of 0.
  • Offset of orders and conditional orders follows the side and the position side: selling on the long side (close long) and buying on the short side (close short) are closing, everything else is opening. In hedge mode the exchange returns reduceOnly as false even for closing conditional orders, so it is not used; only when the position side is one-way (BOTH) or missing are reduceOnly/closePosition used.