1. Go to this page and download the library: Download tigusigalpa/zoomex-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tigusigalpa / zoomex-php example snippets
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);
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')
);
use Tigusigalpa\Zoomex\DTO\Position\GetPositionInfoRequest;
$positions = Zoomex::position()->getPositionInfo(
new GetPositionInfoRequest(category: Category::LINEAR, symbol: 'BTCUSDT')
);
use Tigusigalpa\Zoomex\DTO\Account\GetWalletBalanceRequest;
use Tigusigalpa\Zoomex\Enums\AccountType;
$balance = Zoomex::account()->getWalletBalance(
new GetWalletBalanceRequest(accountType: AccountType::CONTRACT)
);
use Tigusigalpa\Zoomex\WebSocket;
$ws = new WebSocket(['api_key' => '...', 'secret_key' => '...']);
$ws->subscribeOrderbook('BTCUSDT', 50, function ($data) {
print_r($data);
});
$ws->run();