From 296b80c019c7eb659fb4d9460012685cb16d11c4 Mon Sep 17 00:00:00 2001 From: Seyed Mohammad Dabir <20028160+s-mohammad-dabir@users.noreply.github.com> Date: Sun, 10 Feb 2019 01:33:31 +0330 Subject: [PATCH] Add limit parameter for market depth method --- php-binance-api.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/php-binance-api.php b/php-binance-api.php index 72162ba2..f008dcb2 100755 --- a/php-binance-api.php +++ b/php-binance-api.php @@ -723,17 +723,21 @@ public function aggTrades(string $symbol) * $depth = $api->depth("ETHBTC"); * * @param $symbol string the symbol to get the depth information for + * @param $limit int set limition for number of market depth data * @return array with error message or array of market depth * @throws \Exception */ - public function depth(string $symbol) + public function depth(string $symbol, int $limit) { + if (isset($limit) === false || is_int($limit) === false) + $limit = 100; if (isset($symbol) === false || is_string($symbol) === false) { // WPCS: XSS OK. echo "asset: expected bool false, " . gettype($symbol) . " given" . PHP_EOL; } $json = $this->httpRequest("v1/depth", "GET", [ "symbol" => $symbol, + "limit" => $limit, ]); if (isset($this->info[$symbol]) === false) { $this->info[$symbol] = [];