PHP code example of llomgui / wootrade

1. Go to this page and download the library: Download llomgui/wootrade 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/ */

    

llomgui / wootrade example snippets


use llomgui\Wootrade\WootradeApi;

// Debug mode will record the logs of API to files in the directory "WootradeApi::getLogPath()" according to the minimum log level "WootradeApi::getLogLevel()".
WootradeApi::setDebugMode(true);

// Logging in your code
// WootradeApi::setLogPath('/tmp');
// WootradeApi::setLogLevel(Monolog\Logger::DEBUG);
WootradeApi::getLogger()->debug("I'm a debug message");

use llomgui\Wootrade\PublicApi\Exchange;

$exchange = new Exchange();
$result = $exchange->get('SPOT_BTC_USDT');
var_dump($result);

use llomgui\Wootrade\Auth;
use llomgui\Wootrade\PrivateApi\Account;
use llomgui\Wootrade\Exceptions\HttpException;
use llomgui\Wootrade\Exceptions\BusinessException;

$auth = new Auth('API_KEY', 'API_SECRET');
$account = new Account($auth);

try {
    $result = $account->getInformation();
    var_dump($result);
} catch (HttpException $e) {
    var_dump($e->getMessage());
} catch (BusinessException $e) {
    var_dump($e->getMessage());
}