Binance API Class and examples of how to use the API.
composer require baitercel/binance-api-php dev-master
<?php
require 'BinanceClass.php';
$api = new Binance("API_Key","Secret");
$ticker = $api->prices();
print_r($ticker); // List prices of all symbols
echo "Price of BNB: {$ticker['BNBBTC']} BTC.\n";
$balances = $api->balances($ticker);
print_r($balances);
echo "BTC owned: ".$balances['BTC']['available']."\n";
echo "ETH owned: ".$balances['ETH']['available']."\n";
echo "Estimated Value: ".$api->btc_value." BTC\n";
$bookPrices = $api->bookPrices();
print_r($bookPrices);
$quantity = 1;
$price = 0.0005;
$order = $api->buy("BNBBTC", $quantity, $price);
$quantity = 1;
$price = 0.0006;
$order = $api->sell("BNBBTC", $quantity, $price);
$order = $api->buy("BNBBTC", $quantity, 0, "MARKET");
$order = $api->sell("BNBBTC", $quantity, 0, "MARKET");
$trades = $api->trades("BNBBTC");
print_r($trades);
$depth = $api->depth("ETHBTC");
print_r($depth);
$openorders = $api->openOrders("BNBBTC");
print_r($openorders);
$orderid = "7610385";
$orderstatus = $api->orderStatus("ETHBTC", $orderid);
print_r($orderstatus);
$response = $api->cancel("ETHBTC", $orderid);
print_r($response);
$orders = $api->orders("BNBBTC");
print_r($orders);
//Periods: 1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M
$ticks = $api->candlesticks("BNBBTC", "5m");
print_r($ticks);