PHP code example of bitvavo / php-bitvavo-api
1. Go to this page and download the library: Download bitvavo/php-bitvavo-api 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/ */
bitvavo / php-bitvavo-api example snippets
$bitvavo = new Bitvavo([
"APIKEY" => "<APIKEY>",
"APISECRET" => "<APISECRET>",
"RESTURL" => "https://api.bitvavo.com/v2",
"WSURL" => "wss://ws.bitvavo.com/v2/",
"ACCESSWINDOW" => 10000,
"DEBUGGING" => false
]);
$response = $bitvavo->time();
$currentTime = $response["time"];
// Do something with time
echo $currentTime
$response = $bitvavo->time();
echo json_encode($response);
{
"time": 1548686055654
}
// options: market
foreach ($bitvavo->markets([]) as $market) {
echo json_encode($market) . "\n";
}
{
"market": "ADA-BTC",
"status": "trading",
"base": "ADA",
"quote": "BTC",
"pricePrecision": 5,
"minOrderInBaseAsset": "100",
"minOrderInQuoteAsset": "0.001",
"orderTypes": [
"market",
"limit"
]
}
{
"market": "ADA-EUR",
"status": "trading",
"base": "ADA",
"quote": "EUR",
"pricePrecision": 5,
"minOrderInBaseAsset": "100",
"minOrderInQuoteAsset": "10",
"orderTypes": [
"market",
"limit"
]
}
{
"market": "AE-BTC",
"status": "trading",
"base": "AE",
"quote": "BTC",
"pricePrecision": 5,
"minOrderInBaseAsset": "10",
"minOrderInQuoteAsset": "0.001",
"orderTypes": [
"market",
"limit"
]
}
{
"market": "AE-EUR",
"status": "trading",
"base": "AE",
"quote": "EUR",
"pricePrecision": 5,
"minOrderInBaseAsset": "10",
"minOrderInQuoteAsset": "10",
"orderTypes": [
"market",
"limit"
]
}
...
// options: symbol
foreach ($bitvavo->assets([]) as $asset) {
echo json_encode($asset) . "\n";
}
{
"symbol": "ADA",
"name": "Cardano",
"decimals": 6,
"depositFee": "0",
"depositConfirmations": 20,
"depositStatus": "OK",
"withdrawalFee": "0.2",
"withdrawalMinAmount": "0.2",
"withdrawalStatus": "OK",
"networks": [
"Mainnet"
],
"message": ""
}
{
"symbol": "AE",
"name": "Aeternity",
"decimals": 8,
"depositFee": "0",
"depositConfirmations": 30,
"depositStatus": "OK",
"withdrawalFee": "2",
"withdrawalMinAmount": "2",
"withdrawalStatus": "OK",
"networks": [
"Mainnet"
],
"message": ""
}
{
"symbol": "AION",
"name": "Aion",
"decimals": 8,
"depositFee": "0",
"depositConfirmations": 0,
"depositStatus": "",
"withdrawalFee": "3",
"withdrawalMinAmount": "3",
"withdrawalStatus": "",
"networks": [
"Mainnet"
],
"message": ""
}
{
"symbol": "ANT",
"name": "Aragon",
"decimals": 8,
"depositFee": "0",
"depositConfirmations": 30,
"depositStatus": "OK",
"withdrawalFee": "2",
"withdrawalMinAmount": "2",
"withdrawalStatus": "OK",
"networks": [
"Mainnet"
],
"message": ""
}
...
// options: depth
$response = $bitvavo->book("BTC-EUR", []);
echo json_encode($response) . "\n";
{
"market": "BTC-EUR",
"nonce": 5111,
"bids": [
[
"2998.9",
"2.14460302"
],
[
"2998.4",
"0.35156557"
],
[
"2997",
"0.97089768"
],
[
"2996.5",
"0.74129861"
],
[
"2996",
"0.33746089"
],
...
],
"asks": [
[
"2999",
"0.34445088"
],
[
"2999.5",
"0.32306421"
],
[
"3000",
"0.37908805"
],
[
"3000.6",
"0.85330708"
],
[
"3001.7",
"0.31230068"
],
...
]
}
// options: limit, start, end, tradeIdFrom, tradeIdTo
foreach ($bitvavo->publicTrades("BTC-EUR", []) as $trade) {
echo json_encode($trade) . "\n";
}
{
"id": "99cee743-1a9b-4dd4-8337-2a384e490554",
"timestamp": 1548685961053,
"amount": "0.55444771",
"price": "2996.3",
"side": "buy"
}
{
"id": "12d442cf-23a2-43c4-ae20-4b3d61a5993c",
"timestamp": 1548685961047,
"amount": "0.44555229",
"price": "2995.7",
"side": "buy"
}
{
"id": "75335db3-5b94-48af-bdc9-8716e0a3d6ae",
"timestamp": 1548685918958,
"amount": "1",
"price": "2996.1",
"side": "buy"
}
{
"id": "616bfa4e-b3ff-4b3f-a394-1538a49eb9bc",
"timestamp": 1548685870299,
"amount": "1",
"price": "2996",
"side": "buy"
}
{
"id": "34cdda49-3e9d-4d8f-a1aa-3176f61d9c27",
"timestamp": 1548684756948,
"amount": "0.79946345",
"price": "2996.3",
"side": "buy"
}
{
"id": "525a2ae0-7c0d-4945-9e4f-cf5729b44c5c",
"timestamp": 1548684756939,
"amount": "0.06202504",
"price": "2995.6",
"side": "buy"
}
...
// options: limit, start, end
foreach ($bitvavo->candles("LTC-EUR", "1h", []) as $candle) {
echo json_encode($candle) . "\n";
}
[
1548684000000,
"2993.7",
"2996.9",
"2992.5",
"2993.7",
"9"
]
[
1548684000000,
"2993.7",
"2996.9",
"2992.5",
"2993.7",
"9"
]
[
1548676800000,
"2999.3",
"3002.6",
"2989.2",
"2999.3",
"63.00046504"
]
[
1548669600000,
"3012.9",
"3015.8",
"3000",
"3012.9",
"8"
]
[
1548417600000,
"3124",
"3125.1",
"3124",
"3124",
"0.1"
]
...
// options: market
foreach ($bitvavo->tickerPrice([]) as $price) {
echo json_encode($price) . "\n";
}
{
"market": "EOS-EUR",
"price": "2.0142"
}
{
"market": "XRP-EUR",
"price": "0.25193"
}
{
"market": "ETH-EUR",
"price": "91.1"
}
{
"market": "IOST-EUR",
"price": "0.005941"
}
{
"market": "BCH-EUR",
"price": "106.57"
}
{
"market": "BTC-EUR",
"price": "3000.2"
}
{
"market": "STORM-EUR",
"price": "0.0025672"
}
{
"market": "EOS-BTC",
"price": "0.00066289"
}
{
"market": "BSV-EUR",
"price": "57.6"
}
...
// options: market
foreach ($bitvavo->tickerBook([]) as $book) {
echo json_encode($book) . "\n";
}
{
"market": "XVG-BTC",
"bid": "0.00000045",
"ask": "0.00000046",
"bidSize": "28815.01275017",
"askSize": "38392.85089495"
}
{
"market": "XVG-EUR",
"bid": "0.0042213",
"ask": "0.0043277",
"bidSize": "1695671.24837763",
"askSize": "792229.47382889"
}
{
"market": "ZIL-BTC",
"bid": "0.00000082",
"ask": "0.00000083",
"bidSize": "140980.13397262",
"askSize": "98839.99285373"
}
{
"market": "ZIL-EUR",
"bid": "0.0076923",
"ask": "0.0077929",
"bidSize": "348008.13304576",
"askSize": "151544.09942432"
}
{
"market": "ZRX-BTC",
"bid": "0.00001679",
"ask": "0.0000168",
"bidSize": "633.12153002",
"askSize": "1280.07668593"
}
{
"market": "ZRX-EUR",
"bid": "0.1575",
"ask": "0.15774",
"bidSize": "875.01315351",
"askSize": "1013.62085819"
}
...
// options: market
foreach ($bitvavo->ticker24h([]) as $ticker) {
echo json_encode($ticker) . "\n";
}
{
"market": "XVG-EUR",
"open": "0.0043222",
"high": "0.0044139",
"low": "0.0040849",
"last": "0.0041952",
"volume": "1237140.82971657",
"volumeQuote": "5267.56",
"bid": "0.0042245",
"bidSize": "1704411.59895476",
"ask": "0.0043217",
"askSize": "2419888.08209617",
"timestamp": 1565777160307
}
{
"market": "ZIL-EUR",
"open": "0.008125",
"high": "0.0082359",
"low": "0.0076094",
"last": "0.0077285",
"volume": "738574.75091114",
"volumeQuote": "5724.92",
"bid": "0.007698",
"bidSize": "347552.37282041",
"ask": "0.0077977",
"askSize": "151544.09942432",
"timestamp": 1565777159934
}
{
"market": "ZRX-EUR",
"open": "0.16326",
"high": "0.16326",
"low": "0.15812",
"last": "0.15858",
"volume": "4855.99528525",
"volumeQuote": "779.72",
"bid": "0.15748",
"bidSize": "874.65298311",
"ask": "0.15775",
"askSize": "545.84965752",
"timestamp": 1565777159932
}
...
// optional parameters: limit:(amount, price, postOnly), market:(amount, amountQuote, disableMarketProtection),
// stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
// stopLossLimit/takeProfitLimit:(amount, price, postOnly, triggerType, triggerReference, triggerAmount)
// all orderTypes: timeInForce, selfTradePrevention, responseRequired
$response = $bitvavo->placeOrder("BTC-EUR", "buy", "limit", ["amount" => "1", "price" => "2000"]);
echo json_encode($response) . "\n";
{
"orderId": "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b",
"market": "BTC-EUR",
"created": 1548686752319,
"updated": 1548686752319,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1",
"amountRemaining": "1",
"price": "2000",
"onHold": "2005",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
// Optional parameters: limit:(amount, amountRemaining, price, timeInForce, selfTradePrevention, postOnly)
// untriggered stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
// stopLossLimit/takeProfitLimit: (amount, price, postOnly, triggerType, triggerReference, triggerAmount)
$response = $bitvavo->updateOrder("BTC-EUR", "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b", ["amount" => "1.1"]);
echo json_encode($response) . "\n";
{
"orderId": "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b",
"market": "BTC-EUR",
"created": 1548686752319,
"updated": 1548686829227,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1.1",
"amountRemaining": "1.1",
"price": "2000",
"onHold": "2205.5",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
$response = $bitvavo->getOrder("BTC-EUR", "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b");
echo json_encode($response) . "\n";
{
"orderId": "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b",
"market": "BTC-EUR",
"created": 1548686752319,
"updated": 1548686752319,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1",
"amountRemaining": "1",
"price": "2000",
"onHold": "2005",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
$response = $bitvavo->cancelOrder("BTC-EUR", "2557ace7-f9f3-4c15-8911-46022f01cf72");
echo json_encode($response) . "\n";
{
"orderId":"2557ace7-f9f3-4c15-8911-46022f01cf72"
}
// options: limit, start, end, orderIdFrom, orderIdTo
foreach ($bitvavo->getOrders("BTC-EUR", []) as $order) {
echo json_encode($order) . "\n";
}
{
"orderId": "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b",
"market": "BTC-EUR",
"created": 1548686752319,
"updated": 1548686829227,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1.1",
"amountRemaining": "1.1",
"price": "2000",
"onHold": "2205.5",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
{
"orderId": "d0471852-d753-44a9-bc9a-a3f0ddb7c209",
"market": "BTC-EUR",
"created": 1548685870294,
"updated": 1548685870294,
"status": "filled",
"side": "buy",
"orderType": "limit",
"amount": "1",
"amountRemaining": "0",
"price": "3000",
"onHold": "0",
"onHoldCurrency": "EUR",
"filledAmount": "1",
"filledAmountQuote": "2996",
"feePaid": "7.49",
"feeCurrency": "EUR",
"fills": [
{
"id": "616bfa4e-b3ff-4b3f-a394-1538a49eb9bc",
"timestamp": 1548685870299,
"amount": "1",
"price": "2996",
"taker": true,
"fee": "7.49",
"feeCurrency": "EUR",
"settled": true
}
],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
{
"orderId": "80b5f04d-21fc-4ebe-9c5f-6d34f78ee477",
"market": "BTC-EUR",
"created": 1548684420771,
"updated": 1548684420771,
"status": "filled",
"side": "buy",
"orderType": "limit",
"amount": "1",
"amountRemaining": "0",
"price": "3000",
"onHold": "0",
"onHoldCurrency": "EUR",
"filledAmount": "1",
"filledAmountQuote": "2994.47228569",
"feePaid": "7.48771431",
"feeCurrency": "EUR",
"fills": [
{
"id": "ae9b627c-3e64-4c71-b80a-9f674498b478",
"timestamp": 1548684420781,
"amount": "0.82771431",
"price": "2994.3",
"taker": true,
"fee": "6.205041567",
"feeCurrency": "EUR",
"settled": true
},
{
"id": "64cc0e3d-6e7b-451c-9034-9a6dc6c4665a",
"timestamp": 1548684420790,
"amount": "0.17228569",
"price": "2995.3",
"taker": true,
"fee": "1.282672743",
"feeCurrency": "EUR",
"settled": true
}
],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
...
// options: market
foreach ($bitvavo->cancelOrders([]) as $order) {
echo json_encode($order) . "\n";
}
{
"orderId":"8b1c491b-13bd-40e1-b4fa-7d8ecf1f4fc3"
}
{
"orderId":"95313ae5-ad65-4430-a0fb-63591bbc337c"
}
{
"orderId":"2465c3ab-5ae2-4d4d-bec7-345f51b3494d"
}
...
// options: market
foreach ($bitvavo->ordersOpen([]) as $order) {
echo json_encode($order) . "\n";
}
{
"orderId": "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b",
"market": "BTC-EUR",
"created": 1548686752319,
"updated": 1548686829227,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1.1",
"amountRemaining": "1.1",
"price": "2000",
"onHold": "2205.5",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
{
"orderId": "2465c3ab-5ae2-4d4d-bec7-345f51b3494d",
"market": "BTC-EUR",
"created": 1548686566366,
"updated": 1548686789695,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1.0",
"amountRemaining": "1.0",
"price": "2200",
"onHold": "2205",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
...
// options: limit, start, end, tradeIdFrom, tradeIdTo
foreach ($bitvavo->trades("BTC-EUR", []) as $trade) {
echo json_encode($trade) . "\n";
}
{
"id": "616bfa4e-b3ff-4b3f-a394-1538a49eb9bc",
"timestamp": 1548685870299,
"market": "BTC-EUR",
"side": "buy",
"amount": "1",
"price": "2996",
"taker": true,
"fee": "7.49",
"feeCurrency": "EUR",
"settled": true
}
{
"id": "64cc0e3d-6e7b-451c-9034-9a6dc6c4665a",
"timestamp": 1548684420790,
"market": "BTC-EUR",
"side": "buy",
"amount": "0.17228569",
"price": "2995.3",
"taker": true,
"fee": "1.282672743",
"feeCurrency": "EUR",
"settled": true
}
{
"id": "ae9b627c-3e64-4c71-b80a-9f674498b478",
"timestamp": 1548684420781,
"market": "BTC-EUR",
"side": "buy",
"amount": "0.82771431",
"price": "2994.3",
"taker": true,
"fee": "6.205041567",
"feeCurrency": "EUR",
"settled": true
}
{
"id": "f78cc2d2-6044-4a6d-a86f-ff7d307142fb",
"timestamp": 1548683023452,
"market": "BTC-EUR",
"side": "sell",
"amount": "0.74190125",
"price": "2992.5",
"taker": true,
"fee": "5.549490625",
"feeCurrency": "EUR",
"settled": true
}
...
$response = $bitvavo->account();
echo json_encode($response, JSON_PRETTY_PRINT) . "\n";
{
"fees": {
"taker": "0.0025",
"maker": "0.0015",
"volume": "100.00"
}
}
// options: symbol
foreach ($bitvavo->balance([]) as $balance) {
echo json_encode($balance) . "\n";
}
{
"symbol": "EUR",
"available": "2599.95",
"inOrder": "2022.65"
}
{
"symbol": "BTC",
"available": "1.65437",
"inOrder": "0.079398"
}
{
"symbol": "ADA",
"available": "4.8",
"inOrder": "0"
}
{
"symbol": "BCH",
"available": "0.00952811",
"inOrder": "0"
}
{
"symbol": "BSV",
"available": "0.00952811",
"inOrder": "0"
}
...
$response = $bitvavo->depositAssets("BTC");
echo json_encode($response) . "\n";
{
"address": "BitcoinAddress"
}
// optional parameters: paymentId, internal, addWithdrawalFee
$response = $bitvavo->withdrawAssets("BTC", "1", "BitcoinAddress", []);
echo json_encode($response) . "\n";
{
"success": true,
"symbol": "BTC",
"amount": "1"
}
// options: symbol, limit, start, end
foreach ($bitvavo->depositHistory([]) as $deposit) {
echo json_encode($deposit) . "\n";
}
{
"timestamp": 1521550025000,
"symbol": "EUR",
"amount": "1",
"fee": "0",
"status": "completed",
"address": "NL12RABO324234234"
}
{
"timestamp": 1511873910000,
"symbol": "BTC",
"amount": "0.099",
"fee": "0",
"status": "completed",
"txId": "0c6497e608212a516b8218674cb0ca04f65b67a00fe8bddaa1ecb03e9b029255"
}
...
// options: symbol, limit, start, end
foreach ($bitvavo->withdrawalHistory([]) as $withdrawal) {
echo json_encode($withdrawal) . "\n";
}
{
"timestamp": 1548687467000,
"symbol": "BTC",
"amount": "0.99994",
"fee": "0.00006",
"status": "awaiting_processing",
"address": "1CqtG5z55x7bYD5GxsAXPx59DEyujs4bjm"
}
{
"timestamp": 1548682993000,
"symbol": "BTC",
"amount": "0.99994",
"fee": "0.00006",
"status": "awaiting_processing",
"address": "1CqtG5z55x7bYD5GxsAXPx59DEyujs4bjm"
}
{
"timestamp": 1548425559000,
"symbol": "BTC",
"amount": "0.09994",
"fee": "0.00006",
"status": "awaiting_processing",
"address": "1CqtG5z55x7bYD5GxsAXPx59DEyujs4bjm"
}
{
"timestamp": 1548409721000,
"symbol": "EUR",
"amount": "50",
"fee": "0",
"status": "completed",
"address": "NL123BIM"
}
{
"timestamp": 1537803091000,
"symbol": "BTC",
"amount": "0.01939",
"fee": "0.00002",
"status": "completed",
"txId": "da2299c86fce67eb899aeaafbe1f81cf663a3850cf9f3337c92b2d87945532db",
"address": "3QpyxeA7yWWsSURXEmuBBzHpxjqn7Rbyme"
}
...
$websock = $bitvavo->newWebSocket();
$websock->setErrorCallback(function($msg) {
echo "Handle errors here " . json_encode($msg) . "\n";
});
// Call your functions here, like:
$websock->time(function($msg) {
echo json_encode($msg) . "\n";
});
// When the response of the first call is lResponse) {
echo json_encode($cancelResponse) . "\n";
});
}
});
$websock->startSocket();
// Any code written here will not be executed until the websocket has been closed.
$websock->time(function($response) {
echo json_encode($response) . "\n";
});
{
"time": 1548686055654
}
// options: market
$websock->markets([], function($response) {
foreach ($response as $market) {
echo json_encode($market) . "\n";
}
});
{
"market": "ADA-BTC",
"status": "trading",
"base": "ADA",
"quote": "BTC",
"pricePrecision": 5,
"minOrderInBaseAsset": "100",
"minOrderInQuoteAsset": "0.001",
"orderTypes": [
"market",
"limit"
]
}
{
"market": "ADA-EUR",
"status": "trading",
"base": "ADA",
"quote": "EUR",
"pricePrecision": 5,
"minOrderInBaseAsset": "100",
"minOrderInQuoteAsset": "10",
"orderTypes": [
"market",
"limit"
]
}
{
"market": "AE-BTC",
"status": "trading",
"base": "AE",
"quote": "BTC",
"pricePrecision": 5,
"minOrderInBaseAsset": "10",
"minOrderInQuoteAsset": "0.001",
"orderTypes": [
"market",
"limit"
]
}
{
"market": "AE-EUR",
"status": "trading",
"base": "AE",
"quote": "EUR",
"pricePrecision": 5,
"minOrderInBaseAsset": "10",
"minOrderInQuoteAsset": "10",
"orderTypes": [
"market",
"limit"
]
}
...
// options: symbol
$websock->assets([], function($response) {
foreach ($response as $asset) {
echo json_encode($asset) . "\n";
}
});
{
"symbol": "ADA",
"name": "Cardano",
"decimals": 6,
"depositFee": "0",
"depositConfirmations": 20,
"depositStatus": "OK",
"withdrawalFee": "0.2",
"withdrawalMinAmount": "0.2",
"withdrawalStatus": "OK",
"networks": [
"Mainnet"
],
"message": ""
}
{
"symbol": "AE",
"name": "Aeternity",
"decimals": 8,
"depositFee": "0",
"depositConfirmations": 30,
"depositStatus": "OK",
"withdrawalFee": "2",
"withdrawalMinAmount": "2",
"withdrawalStatus": "OK",
"networks": [
"Mainnet"
],
"message": ""
}
{
"symbol": "AION",
"name": "Aion",
"decimals": 8,
"depositFee": "0",
"depositConfirmations": 0,
"depositStatus": "",
"withdrawalFee": "3",
"withdrawalMinAmount": "3",
"withdrawalStatus": "",
"networks": [
"Mainnet"
],
"message": ""
}
{
"symbol": "ANT",
"name": "Aragon",
"decimals": 8,
"depositFee": "0",
"depositConfirmations": 30,
"depositStatus": "OK",
"withdrawalFee": "2",
"withdrawalMinAmount": "2",
"withdrawalStatus": "OK",
"networks": [
"Mainnet"
],
"message": ""
}
...
// options: depth
$websock->book("BTC-EUR", [], function($response) {
echo json_encode($response) . "\n";
});
{
"market": "BTC-EUR",
"nonce": 5111,
"bids": [
[
"2998.9",
"2.14460302"
],
[
"2998.4",
"0.35156557"
],
[
"2997",
"0.97089768"
],
[
"2996.5",
"0.74129861"
],
[
"2996",
"0.33746089"
],
...
],
"asks": [
[
"2999",
"0.34445088"
],
[
"2999.5",
"0.32306421"
],
[
"3000",
"0.37908805"
],
[
"3000.6",
"0.85330708"
],
[
"3001.7",
"0.31230068"
],
...
]
}
// options: limit, start, end
$websock->publicTrades("BTC-EUR", [], function($response) {
echo json_encode($response) . "\n";
});
{
"id": "99cee743-1a9b-4dd4-8337-2a384e490554",
"timestamp": 1548685961053,
"amount": "0.55444771",
"price": "2996.3",
"side": "buy"
}
{
"id": "12d442cf-23a2-43c4-ae20-4b3d61a5993c",
"timestamp": 1548685961047,
"amount": "0.44555229",
"price": "2995.7",
"side": "buy"
}
{
"id": "75335db3-5b94-48af-bdc9-8716e0a3d6ae",
"timestamp": 1548685918958,
"amount": "1",
"price": "2996.1",
"side": "buy"
}
{
"id": "616bfa4e-b3ff-4b3f-a394-1538a49eb9bc",
"timestamp": 1548685870299,
"amount": "1",
"price": "2996",
"side": "buy"
}
{
"id": "34cdda49-3e9d-4d8f-a1aa-3176f61d9c27",
"timestamp": 1548684756948,
"amount": "0.79946345",
"price": "2996.3",
"side": "buy"
}
{
"id": "525a2ae0-7c0d-4945-9e4f-cf5729b44c5c",
"timestamp": 1548684756939,
"amount": "0.06202504",
"price": "2995.6",
"side": "buy"
}
...
// options: limit
$websock->candles("LTC-EUR", "1h", [], function($response) {
foreach ($response as $candle) {
echo json_encode($candle) . "\n";
}
});
[
1548684000000,
"2993.7",
"2996.9",
"2992.5",
"2993.7",
"9"
]
[
1548684000000,
"2993.7",
"2996.9",
"2992.5",
"2993.7",
"9"
]
[
1548676800000,
"2999.3",
"3002.6",
"2989.2",
"2999.3",
"63.00046504"
]
[
1548669600000,
"3012.9",
"3015.8",
"3000",
"3012.9",
"8"
]
[
1548417600000,
"3124",
"3125.1",
"3124",
"3124",
"0.1"
]
...
// options: market
$websock->tickerPrice([], function($response) {
foreach ($response as $price) {
echo json_encode($price) . "\n";
}
});
{
"market": "EOS-EUR",
"price": "2.0142"
}
{
"market": "XRP-EUR",
"price": "0.25193"
}
{
"market": "ETH-EUR",
"price": "91.1"
}
{
"market": "IOST-EUR",
"price": "0.005941"
}
{
"market": "BCH-EUR",
"price": "106.57"
}
{
"market": "BTC-EUR",
"price": "3000.2"
}
{
"market": "STORM-EUR",
"price": "0.0025672"
}
{
"market": "EOS-BTC",
"price": "0.00066289"
}
{
"market": "BSV-EUR",
"price": "57.6"
}
...
// options: market
$websock->tickerBook([], function($response) {
foreach ($response as $book) {
echo json_encode($book) . "\n";
}
});
{
"market": "XVG-BTC",
"bid": "0.00000045",
"ask": "0.00000046",
"bidSize": "28815.01275017",
"askSize": "38392.85089495"
}
{
"market": "XVG-EUR",
"bid": "0.0042213",
"ask": "0.0043277",
"bidSize": "1695671.24837763",
"askSize": "792229.47382889"
}
{
"market": "ZIL-BTC",
"bid": "0.00000082",
"ask": "0.00000083",
"bidSize": "140980.13397262",
"askSize": "98839.99285373"
}
{
"market": "ZIL-EUR",
"bid": "0.0076923",
"ask": "0.0077929",
"bidSize": "348008.13304576",
"askSize": "151544.09942432"
}
{
"market": "ZRX-BTC",
"bid": "0.00001679",
"ask": "0.0000168",
"bidSize": "633.12153002",
"askSize": "1280.07668593"
}
{
"market": "ZRX-EUR",
"bid": "0.1575",
"ask": "0.15774",
"bidSize": "875.01315351",
"askSize": "1013.62085819"
}
...
// options: market
$websock->ticker24h([], function($response) {
foreach ($response as $ticker) {
echo json_encode($ticker) . "\n";
}
});
{
"market": "XVG-EUR",
"open": "0.0043222",
"high": "0.0044139",
"low": "0.0040849",
"last": "0.0041952",
"volume": "1237140.82971657",
"volumeQuote": "5267.56",
"bid": "0.0042245",
"bidSize": "1704411.59895476",
"ask": "0.0043217",
"askSize": "2419888.08209617",
"timestamp": 1565777160307
}
{
"market": "ZIL-EUR",
"open": "0.008125",
"high": "0.0082359",
"low": "0.0076094",
"last": "0.0077285",
"volume": "738574.75091114",
"volumeQuote": "5724.92",
"bid": "0.007698",
"bidSize": "347552.37282041",
"ask": "0.0077977",
"askSize": "151544.09942432",
"timestamp": 1565777159934
}
{
"market": "ZRX-EUR",
"open": "0.16326",
"high": "0.16326",
"low": "0.15812",
"last": "0.15858",
"volume": "4855.99528525",
"volumeQuote": "779.72",
"bid": "0.15748",
"bidSize": "874.65298311",
"ask": "0.15775",
"askSize": "545.84965752",
"timestamp": 1565777159932
}
...
// optional parameters: limit:(amount, price, postOnly), market:(amount, amountQuote, disableMarketProtection),
// stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
// stopLossLimit/takeProfitLimit:(amount, price, postOnly, triggerType, triggerReference, triggerAmount)
// all orderTypes: timeInForce, selfTradePrevention, responseRequired
$websock->placeOrder("BTC-EUR", "buy", "limit", ["amount" => "0.1", "price" => "5000"], function($response) {
echo json_encode($response) . "\n";
});
{
"orderId": "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b",
"market": "BTC-EUR",
"created": 1548686752319,
"updated": 1548686752319,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1",
"amountRemaining": "1",
"price": "2000",
"onHold": "2005",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
// Optional parameters: limit:(amount, amountRemaining, price, timeInForce, selfTradePrevention, postOnly)
// untriggered stopLoss/takeProfit:(amount, amountQuote, disableMarketProtection, triggerType, triggerReference, triggerAmount)
// stopLossLimit/takeProfitLimit: (amount, price, postOnly, triggerType, triggerReference, triggerAmount)
$websock->updateOrder("BTC-EUR", "68322e0d-1a41-4e39-bc26-8c9b9a268a81", ["amount" => "0.2"], function($response) {
echo json_encode($response) . "\n";
});
{
"orderId": "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b",
"market": "BTC-EUR",
"created": 1548686752319,
"updated": 1548686829227,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1.1",
"amountRemaining": "1.1",
"price": "2000",
"onHold": "2205.5",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
$websock->getOrder("BTC-EUR", "68322e0d-1a41-4e39-bc26-8c9b9a268a81", function($response) {
echo json_encode($response) . "\n";
});
{
"orderId": "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b",
"market": "BTC-EUR",
"created": 1548686752319,
"updated": 1548686752319,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1",
"amountRemaining": "1",
"price": "2000",
"onHold": "2005",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
$websock->cancelOrder("BTC-EUR", "68322e0d-1a41-4e39-bc26-8c9b9a268a81", function($response) {
echo json_encode($response) . "\n";
});
{
"orderId":"2557ace7-f9f3-4c15-8911-46022f01cf72"
}
// options: limit, start, end, orderIdFrom, orderIdTo
$websock->getOrders("BTC-EUR", [], function($response) {
foreach ($response as $order) {
echo json_encode($order) . "\n";
}
});
{
"orderId": "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b",
"market": "BTC-EUR",
"created": 1548686752319,
"updated": 1548686829227,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1.1",
"amountRemaining": "1.1",
"price": "2000",
"onHold": "2205.5",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
{
"orderId": "d0471852-d753-44a9-bc9a-a3f0ddb7c209",
"market": "BTC-EUR",
"created": 1548685870294,
"updated": 1548685870294,
"status": "filled",
"side": "buy",
"orderType": "limit",
"amount": "1",
"amountRemaining": "0",
"price": "3000",
"onHold": "0",
"onHoldCurrency": "EUR",
"filledAmount": "1",
"filledAmountQuote": "2996",
"feePaid": "7.49",
"feeCurrency": "EUR",
"fills": [
{
"id": "616bfa4e-b3ff-4b3f-a394-1538a49eb9bc",
"timestamp": 1548685870299,
"amount": "1",
"price": "2996",
"taker": true,
"fee": "7.49",
"feeCurrency": "EUR",
"settled": true
}
],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
{
"orderId": "80b5f04d-21fc-4ebe-9c5f-6d34f78ee477",
"market": "BTC-EUR",
"created": 1548684420771,
"updated": 1548684420771,
"status": "filled",
"side": "buy",
"orderType": "limit",
"amount": "1",
"amountRemaining": "0",
"price": "3000",
"onHold": "0",
"onHoldCurrency": "EUR",
"filledAmount": "1",
"filledAmountQuote": "2994.47228569",
"feePaid": "7.48771431",
"feeCurrency": "EUR",
"fills": [
{
"id": "ae9b627c-3e64-4c71-b80a-9f674498b478",
"timestamp": 1548684420781,
"amount": "0.82771431",
"price": "2994.3",
"taker": true,
"fee": "6.205041567",
"feeCurrency": "EUR",
"settled": true
},
{
"id": "64cc0e3d-6e7b-451c-9034-9a6dc6c4665a",
"timestamp": 1548684420790,
"amount": "0.17228569",
"price": "2995.3",
"taker": true,
"fee": "1.282672743",
"feeCurrency": "EUR",
"settled": true
}
],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
...
// options: market
$websock->cancelOrders(["market" => "BTC-EUR"], function($response) {
foreach ($response as $deletion) {
echo json_encode($deletion) . "\n";
}
});
{
"orderId":"8b1c491b-13bd-40e1-b4fa-7d8ecf1f4fc3"
}
{
"orderId":"95313ae5-ad65-4430-a0fb-63591bbc337c"
}
{
"orderId":"2465c3ab-5ae2-4d4d-bec7-345f51b3494d"
}
...
// options: market
$websock->ordersOpen([], function($response) {
foreach ($response as $order) {
echo json_encode($order) . "\n";
}
});
{
"orderId": "97d89ffc-2339-4e8f-8032-bf7b8c9ee65b",
"market": "BTC-EUR",
"created": 1548686752319,
"updated": 1548686829227,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1.1",
"amountRemaining": "1.1",
"price": "2000",
"onHold": "2205.5",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
{
"orderId": "2465c3ab-5ae2-4d4d-bec7-345f51b3494d",
"market": "BTC-EUR",
"created": 1548686566366,
"updated": 1548686789695,
"status": "new",
"side": "buy",
"orderType": "limit",
"amount": "1.0",
"amountRemaining": "1.0",
"price": "2200",
"onHold": "2205",
"onHoldCurrency": "EUR",
"filledAmount": "0",
"filledAmountQuote": "0",
"feePaid": "0",
"feeCurrency": "EUR",
"fills": [],
"selfTradePrevention": "decrementAndCancel",
"visible": true,
"timeInForce": "GTC",
"postOnly": false
}
...
// options: limit, start, end, tradeIdFrom, tradeIdTo
$websock->trades("BTC-EUR", [], function($response) {
foreach ($response as $trade) {
echo json_encode($trade) . "\n";
}
});
{
"id": "616bfa4e-b3ff-4b3f-a394-1538a49eb9bc",
"timestamp": 1548685870299,
"market": "BTC-EUR",
"side": "buy",
"amount": "1",
"price": "2996",
"taker": true,
"fee": "7.49",
"feeCurrency": "EUR",
"settled": true
}
{
"id": "64cc0e3d-6e7b-451c-9034-9a6dc6c4665a",
"timestamp": 1548684420790,
"market": "BTC-EUR",
"side": "buy",
"amount": "0.17228569",
"price": "2995.3",
"taker": true,
"fee": "1.282672743",
"feeCurrency": "EUR",
"settled": true
}
{
"id": "ae9b627c-3e64-4c71-b80a-9f674498b478",
"timestamp": 1548684420781,
"market": "BTC-EUR",
"side": "buy",
"amount": "0.82771431",
"price": "2994.3",
"taker": true,
"fee": "6.205041567",
"feeCurrency": "EUR",
"settled": true
}
{
"id": "f78cc2d2-6044-4a6d-a86f-ff7d307142fb",
"timestamp": 1548683023452,
"market": "BTC-EUR",
"side": "sell",
"amount": "0.74190125",
"price": "2992.5",
"taker": true,
"fee": "5.549490625",
"feeCurrency": "EUR",
"settled": true
}
...
$websock->account(function($response) {
echo json_encode($response, JSON_PRETTY_PRINT) . "\n";
});
{
"fees": {
"taker": "0.0025",
"maker": "0.0015",
"volume": "100.00"
}
}
// options: symbol
$websock->balance([], function($response) {
foreach ($response as $balance) {
echo json_encode($balance) . "\n";
}
});
{
"symbol": "EUR",
"available": "2599.95",
"inOrder": "2022.65"
}
{
"symbol": "BTC",
"available": "1.65437",
"inOrder": "0.079398"
}
{
"symbol": "ADA",
"available": "4.8",
"inOrder": "0"
}
{
"symbol": "BCH",
"available": "0.00952811",
"inOrder": "0"
}
{
"symbol": "BSV",
"available": "0.00952811",
"inOrder": "0"
}
...
$websock->depositAssets("BTC", function($response) {
echo json_encode($response) . "\n";
});
{
"address": "BitcoinAddress"
}
// optional parameters: paymentId, internal, addWithdrawalFee
$websock->withdrawAssets("BTC", "1", "BitcoinAddress", [], function($response) {
echo json_encode($response) . "\n";
});
{
"success": true,
"symbol": "BTC",
"amount": "1"
}
// options: symbol, limit, start, end
$websock->depositHistory([], function($response) {
foreach ($response as $deposit) {
echo json_encode($deposit) . "\n";
}
});
{
"timestamp": 1521550025000,
"symbol": "EUR",
"amount": "1",
"fee": "0",
"status": "completed",
"address": "NL12RABO324234234"
}
{
"timestamp": 1511873910000,
"symbol": "BTC",
"amount": "0.099",
"fee": "0",
"status": "completed",
"txId": "0c6497e608212a516b8218674cb0ca04f65b67a00fe8bddaa1ecb03e9b029255"
}
...
// options: symbol, limit, start, end
$websock->withdrawalHistory([], function($response) {
foreach ($response as $withdrawal) {
echo json_encode($withdrawal) . "\n";
}
});
{
"timestamp": 1548687467000,
"symbol": "BTC",
"amount": "0.99994",
"fee": "0.00006",
"status": "awaiting_processing",
"address": "1CqtG5z55x7bYD5GxsAXPx59DEyujs4bjm"
}
{
"timestamp": 1548682993000,
"symbol": "BTC",
"amount": "0.99994",
"fee": "0.00006",
"status": "awaiting_processing",
"address": "1CqtG5z55x7bYD5GxsAXPx59DEyujs4bjm"
}
{
"timestamp": 1548425559000,
"symbol": "BTC",
"amount": "0.09994",
"fee": "0.00006",
"status": "awaiting_processing",
"address": "1CqtG5z55x7bYD5GxsAXPx59DEyujs4bjm"
}
{
"timestamp": 1548409721000,
"symbol": "EUR",
"amount": "50",
"fee": "0",
"status": "completed",
"address": "NL123BIM"
}
{
"timestamp": 1537803091000,
"symbol": "BTC",
"amount": "0.01939",
"fee": "0.00002",
"status": "completed",
"txId": "da2299c86fce67eb899aeaafbe1f81cf663a3850cf9f3337c92b2d87945532db",
"address": "3QpyxeA7yWWsSURXEmuBBzHpxjqn7Rbyme"
}
...
$websock->subscriptionTicker("BTC-EUR", function($response) {
echo json_encode($response) . "\n";
});
{
"event": "ticker",
"market": "BTC-EUR",
"bestAsk": "9410.1",
"bestAskSize": "0.10847628",
"lastPrice": "9335"
}
$websock->subscriptionTicker24h("BTC-EUR", function($response) {
echo json_encode($response) . "\n";
});
{
"market": "BTC-EUR",
"open": "10061",
"high": "10061",
"low": "9265.4",
"last": "9400.3",
"volume": "309.30172822",
"volumeQuote": "2993760.89",
"bid": "9400.1",
"bidSize": "0.10576468",
"ask": "9400.4",
"askSize": "0.10858821",
"timestamp": 1565777506453
}
$websock->subscriptionAccount("BTC-EUR", function($function){
echo json_encode($response) . "\n";
});
PHP
$websock->subscriptionCandles("BTC-EUR", "1h", function($response) {
echo json_encode($response) . "\n";
});
PHP
$websock->subscriptionTrades("BTC-EUR", function($response) {
echo json_encode($response) . "\n";
});
PHP
$webSock->subscriptionBookUpdate("BTC-EUR", function($response){
echo json_encode($response) . "\n";
});
PHP
$websock->subscriptionBook("BTC-EUR", function($response) {
echo json_encode($response) . "\n";
});