tigusigalpa / zoomex-php
PHP client for Zoomex cryptocurrency exchange API v3. Supports all REST and WebSocket endpoints: market data, trading, positions, account, assets. HMAC_SHA256 authentication, testnet/mainnet support.
v1.0.0
2026-03-15 18:34 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- ratchet/pawl: ^0.4
Requires (Dev)
- mockery/mockery: ^1.6
- orchestra/testbench: ^7.0|^8.0|^9.0
- pestphp/pest: ^2.0
README
Also available: Zoomex Go Client
PHP/Laravel SDK for Zoomex crypto exchange API v3. Works with REST and WebSocket — market data, trading, positions, account, assets.
What's inside
- Full Zoomex API v3 coverage (REST + WebSocket)
- HMAC-SHA256 request signing
- Laravel support out of the box (service provider, facade, config)
- Testnet/mainnet switching
- PHP 8.1+ with enums and strict types
- Tested with Pest
Requirements
- PHP 8.1+
- Composer
- Laravel 9/10/11/12 (optional)
Installation
composer require tigusigalpa/zoomex-php
Setup
Laravel
php artisan vendor:publish --tag=zoomex-config
.env:
ZOOMEX_API_KEY=your_api_key ZOOMEX_SECRET_KEY=your_secret_key ZOOMEX_TESTNET=false
Standalone PHP
use Tigusigalpa\Zoomex\Client; $client = new Client([ 'api_key' => 'your_api_key', 'secret_key' => 'your_secret_key', 'testnet' => false, ]); // or fluent style $client = Client::make() ->withApiKey('your_api_key') ->withSecretKey('your_secret_key') ->withTestnet(false);
Quick examples
Get tickers
use Tigusigalpa\Zoomex\Facades\Zoomex; use Tigusigalpa\Zoomex\DTO\Market\GetTickersRequest; use Tigusigalpa\Zoomex\Enums\Category; $tickers = Zoomex::market()->getTickers( new GetTickersRequest(category: Category::LINEAR, symbol: 'BTCUSDT') );
Place order
use Tigusigalpa\Zoomex\DTO\Trade\PlaceOrderRequest; use Tigusigalpa\Zoomex\Enums\{Category, OrderSide, OrderType, TimeInForce}; $order = Zoomex::trade()->placeOrder(new PlaceOrderRequest( category: Category::LINEAR, symbol: 'BTCUSDT', side: OrderSide::BUY, orderType: OrderType::LIMIT, qty: '0.01', price: '50000', timeInForce: TimeInForce::GTC ));
Get positions
use Tigusigalpa\Zoomex\DTO\Position\GetPositionInfoRequest; $positions = Zoomex::position()->getPositionInfo( new GetPositionInfoRequest(category: Category::LINEAR, symbol: 'BTCUSDT') );
Get wallet balance
use Tigusigalpa\Zoomex\DTO\Account\GetWalletBalanceRequest; use Tigusigalpa\Zoomex\Enums\AccountType; $balance = Zoomex::account()->getWalletBalance( new GetWalletBalanceRequest(accountType: AccountType::CONTRACT) );
WebSocket — orderbook stream
use Tigusigalpa\Zoomex\WebSocket; $ws = new WebSocket(['api_key' => '...', 'secret_key' => '...']); $ws->subscribeOrderbook('BTCUSDT', 50, function ($data) { print_r($data); }); $ws->run();
WebSocket — private order updates
$ws->subscribePrivateOrders(function ($data) { print_r($data); });
API Reference
Market (public)
| Method | Endpoint | Description |
|---|---|---|
getServerTime() |
/cloud/trade/v3/market/time |
Get server time |
getKline() |
/cloud/trade/v3/market/kline |
Get kline data |
getMarkPriceKline() |
/cloud/trade/v3/market/mark-price-kline |
Get mark price kline |
getIndexPriceKline() |
/cloud/trade/v3/market/index-price-kline |
Get index price kline |
getPremiumIndexPriceKline() |
/cloud/trade/v3/market/premium-index-price-kline |
Get premium index price kline |
getInstrumentsInfo() |
/cloud/trade/v3/market/instruments-info |
Get instruments info |
getOrderbook() |
/cloud/trade/v3/market/orderbook |
Get orderbook |
getTickers() |
/cloud/trade/v3/market/tickers |
Get tickers |
getFundingRateHistory() |
/cloud/trade/v3/market/funding/history |
Get funding rate history |
getPublicTradingHistory() |
/cloud/trade/v3/market/recent-trade |
Get public trading history |
getRiskLimit() |
/cloud/trade/v3/market/risk-limit/info |
Get risk limit |
Trade (private)
| Method | Endpoint | Description |
|---|---|---|
placeOrder() |
/cloud/trade/v3/order/create |
Place order |
amendOrder() |
/cloud/trade/v3/order/amend |
Amend order |
cancelOrder() |
/cloud/trade/v3/order/cancel |
Cancel order |
getOpenOrders() |
/cloud/trade/v3/order/realtime |
Get open orders |
cancelAllOrders() |
/cloud/trade/v3/order/cancel-all |
Cancel all orders |
getOrderHistory() |
/cloud/trade/v3/order/history |
Get order history |
getTradeHistory() |
/cloud/trade/v3/execution/list |
Get trade history |
Position (private)
| Method | Endpoint | Description |
|---|---|---|
getPositionInfo() |
/cloud/trade/v3/position/list |
Get position info |
setLeverage() |
/cloud/trade/v3/position/set-leverage |
Set leverage |
switchIsolated() |
/cloud/trade/v3/position/switch-isolated |
Switch cross/isolated margin |
setTpSlMode() |
/cloud/trade/v3/position/set-tpsl-mode |
Set TP/SL mode |
switchPositionMode() |
/cloud/trade/v3/position/switch-mode |
Switch position mode |
setRiskLimit() |
/cloud/trade/v3/position/set-risk-limit |
Confirm new risk limit |
setTradingStop() |
/cloud/trade/v3/position/trading-stop |
Set trading stop |
setAutoAddMargin() |
/cloud/trade/v3/position/set-auto-add-margin |
Set auto add margin |
addOrReduceMargin() |
/cloud/trade/v3/position/add-margin |
Add or reduce margin |
getClosedPnl() |
/cloud/trade/v3/position/closed-pnl |
Get closed PnL |
Account (private)
| Method | Endpoint | Description |
|---|---|---|
getWalletBalance() |
/cloud/trade/v3/account/wallet-balance |
Get wallet balance |
getFeeRate() |
/cloud/trade/v3/account/fee-rate |
Get fee rate |
getAccountInfo() |
/cloud/trade/v3/account/info |
Get account info |
Asset (private)
| Method | Endpoint | Description |
|---|---|---|
getCoinExchangeRecords() |
/cloud/trade/v3/asset/coin-exchange-record |
Get coin exchange records |
getDeliveryRecord() |
/cloud/trade/v3/asset/delivery-record |
Get delivery record |
getSettlementRecord() |
/cloud/trade/v3/asset/settlement-record |
Get settlement record |
getAssetInfo() |
/cloud/trade/v3/asset/info |
Get asset info |
getAllCoinsBalance() |
/cloud/trade/v3/asset/all-coins-balance |
Get all coins balance |
getInternalTransferRecords() |
/cloud/trade/v3/asset/transfer/query-inter-transfer-list |
Get internal transfer records |
getSubUIDList() |
/cloud/trade/v3/asset/transfer/query-sub-member-list |
Get sub UID list |
createInternalTransfer() |
/cloud/trade/v3/asset/transfer/inter-transfer |
Create internal transfer |
getDepositRecords() |
/cloud/trade/v3/asset/deposit/query-record |
Get deposit records |
getWithdrawalRecords() |
/cloud/trade/v3/asset/withdraw/query-record |
Get withdrawal records |
getCoinInfo() |
/cloud/trade/v3/asset/coin/query-info |
Get coin info |
withdraw() |
/cloud/trade/v3/asset/withdraw/create |
Withdraw |
cancelWithdrawal() |
/cloud/trade/v3/asset/withdraw/cancel |
Cancel withdrawal |
WebSocket Topics
| Channel Type | Topic Pattern | Description |
|---|---|---|
| Public | orderbook.{depth}.{symbol} |
Orderbook (depth: 1, 50, 200, 1000) |
| Public | publicTrade.{symbol} |
Public trades |
| Public | tickers.{symbol} |
Ticker |
| Public | kline.{interval}.{symbol} |
Kline |
| Public | liquidation.{symbol} |
All liquidation |
| Private | order |
Order updates |
| Private | position |
Position updates |
| Private | execution |
Execution updates |
| Private | wallet |
Wallet updates |
Errors
Two exception types:
ZoomexApiException— API returned error (retCode !== 0)ZoomexRequestException— HTTP/network failure
use Tigusigalpa\Zoomex\Exceptions\{ZoomexApiException, ZoomexRequestException}; try { $order = Zoomex::trade()->placeOrder($request); } catch (ZoomexApiException $e) { // $e->retCode, $e->retMsg } catch (ZoomexRequestException $e) { // network issue }
Rate limits
See official docs.
Testing
composer test
Contributing
See CONTRIBUTING.md.
Security
Found a vulnerability? Email sovletig@gmail.com (don't open public issues).
Author
Based on zoomex-go.
License
MIT. See LICENSE.