PHP code example of reilag / kuna-api-php

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

    

reilag / kuna-api-php example snippets




use Kuna\Client;

$kuna = new Client();
$timestamp = $kuna->publicMethod()->timestamp(); //1466486485


use Kuna\Client;
use Kuna\Constant;

$kuna = new Client();
$tickers = $kuna->publicMethod()->tickers(Constant::MARKET_BTCUAH);

print_r($tickers);

use Kuna\Client;
use Kuna\Constant;

$kuna = new Client();
$orderBook = $kuna->publicMethod()->orderBook(Constant::MARKET_BTCUAH);

print_r($orderBook);

use Kuna\Client;
use Kuna\Constant;

$kuna = new Client();
$trades = $kuna->publicMethod()->trades(Constant::MARKET_BTCUAH);

print_r($trades);

use Kuna\Client;

$kuna = new Client([
	"publicKey" => "Your public key",
	"secretKey" => "Your secret key",
]);

$privateMethod = $kuna->privateMethod();


$me = $privateMethod->me();
print_r($me);

$orderMethod = $privateMethod->order();

/**
 * $price
 * $volume
 * $side
 * $market
 */
$newOrder = $orderMethod->create(18000, 0.1, Constant::SIDE_BUY, Constant::MARKET_BTCUAH);

print_r($newOrder);

$orderMethod = $privateMethod->order();

/**
 * @property int $orderId
 */
$deletedOrder = $orderMethod->delete(3091);

print_r($deletedOrder);

$orderMethod = $privateMethod->order();

$orderList = $orderMethod->orderList(Constant::MARKET_BTCUAH);

print_r($orderList);
bash
# Install Composer
curl -sS https://getcomposer.org/installer | php

# Add dependency
php composer.phar