Skip to content

Commit cf7413a

Browse files
committed
orders() updated
1 parent 56b0b48 commit cf7413a

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

php-binance-api.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -596,22 +596,26 @@ public function cancelOpenOrders(string $symbol, array $params = [])
596596
/**
597597
* orders attempts to get the orders for all or a specific currency
598598
*
599+
* @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#all-orders-user_data
600+
*
599601
* $allBNBOrders = $api->orders( "BNBBTC" );
600602
*
601-
* @param $symbol string the currency symbol
602-
* @param $limit int the amount of orders returned
603-
* @param $fromOrderId string return the orders from this order onwards
604-
* @param $params array optional startTime, endTime parameters
603+
* @param string $symbol (mandatory) the currency symbol
604+
* @param int $limit (optional) the amount of orders returned (default 500, max 1000)
605+
* @param string $fromOrderId (optional) return the orders from this order onwards
606+
* @param array $params (optional) an array of additional parameters that the API endpoint allows
605607
* @return array with error message or array of orderDetails array
606608
* @throws \Exception
607609
*/
608-
public function orders(string $symbol, int $limit = 500, int $fromOrderId = 0, array $params = [])
610+
public function orders(string $symbol, ?int $limit = null, int $fromOrderId = null, array $params = [])
609611
{
610612
$request = [
611613
"symbol" => $symbol,
612-
"limit" => $limit,
613614
];
614-
if ($fromOrderId) {
615+
if (!is_null($limit)) {
616+
$request["limit"] = $limit;
617+
}
618+
if (!is_null($fromOrderId)) {
615619
$request["orderId"] = $fromOrderId;
616620
}
617621
return $this->apiRequest("v3/allOrders", "GET", array_merge($request, $params), true);

0 commit comments

Comments
 (0)