PHP code example of iamirnet / azbitcom

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

    

iamirnet / azbitcom example snippets



// config by specifying api key and secret
$api = new \iAmirNet\Azbit\Client("<api key>","<secret>");

//Call this before running any functions
print_r($api->currencies());

//Call this before running any functions
print_r($api->currenciesPairs());

//Call this before running any functions
print_r($api->currenciesPair("BTC_USDT"));

//Call this before running any functions
print_r($api->currenciesCommissions());

//Call this before running any functions
print_r($api->currenciesUserCommissions());

//Call this before running any functions
$sinceDate = "2021-02-05T14:00:00";
$endDate = "2021-02-05T15:00:00";
$pageNumber = 1;
$pageSize = 20;
print_r($api->trades("BTC_USDT",/* optional */ $sinceDate,/* optional */  $endDate,/* optional */ $pageNumber,/* optional */  $pageSize));

//Call this before running any functions
$sinceDate = "2021-02-05T14:00:00";
$endDate = "2021-02-05T15:00:00";
$pageNumber = 1;
$pageSize = 20;
print_r($api->myTrades("BTC_USDT",/* optional */ $sinceDate,/* optional */  $endDate,/* optional */ $pageNumber,/* optional */  $pageSize));

//Call this before running any functions
print_r($api->ticker("BTC_USDT"));

//Call this before running any functions
print_r($api->kline("BTC_USDT",/* year, month, day, hour4, hour, minutes30, minutes15, minutes5, minutes3, minute */  "minute",/* Example: "2021-02-05T14:00:00" */ false,/* Example: "2021-02-05T14:00:00" */ false));

//Call this before running any functions
print_r($api->orderbook("BTC_USDT"));

//Call this before running any functions
$quantity = 1;
$price = 0.0005;
print_r($api->buy("BTC_USDT", $quantity, $price, "LIMIT"));

//Call this before running any functions
$quantity = 1;
$price = 0.0006;
print_r($api->sell("BTC_USDT", $quantity, $price, "LIMIT"));

//Call this before running any functions
$orderId = "3fa85f64-5717-4562-b3fc-2c963f66afa6";
print_r($api->cancel($orderId));

//Call this before running any functions
print_r($api->cancel("BTC_USDT"));

//Call this before running any functions
$orderId = "3fa85f64-5717-4562-b3fc-2c963f66afa6";
print_r($api->orderInfo($orderId));

$orders = $api->orders("BTC_USDT",/* "all" / "active" / "canceled" */  "all");
print_r($orders);

//Call this before running any functions
print_r($api->wallet());

//Call this before running any functions
print_r($api->balances());

//Call this before running any functions
print_r($api->limits());

//Call this before running any functions
print_r($api->address("BTC_USDT"));

//Call this before running any functions
print_r($api->withdrawal("BTC_USDT", "address", "addressPublicKey",/* amount */ 0.05));

sudo apt-get install curl php-curl
curl -s http://getcomposer.org/installer | php
php composer.phar install

php composer.phar