Skip to content

Commit 56b0b48

Browse files
committed
openOrders and cancelOpenOrders updated
1 parent e03ed59 commit 56b0b48

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

php-binance-api.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -554,17 +554,19 @@ public function orderStatus(string $symbol, ?string $orderid = null, array $para
554554
/**
555555
* openOrders attempts to get open orders for all currencies or a specific currency
556556
*
557+
* @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#current-open-orders-user_data
558+
*
557559
* $allOpenOrders = $api->openOrders();
558560
* $allBNBOrders = $api->openOrders( "BNBBTC" );
559561
*
560-
* @param $symbol string the currency symbol
562+
* @param string $symbol (optional) the market symbol
561563
* @return array with error message or the order details
562564
* @throws \Exception
563565
*/
564-
public function openOrders($symbol = null, array $params = [])
566+
public function openOrders(?string $symbol = null, array $params = [])
565567
{
566568
$request = [];
567-
if (is_null($symbol) != true) {
569+
if (!is_null($symbol)) {
568570
$request = [
569571
"symbol" => $symbol,
570572
];
@@ -573,20 +575,21 @@ public function openOrders($symbol = null, array $params = [])
573575
}
574576

575577
/**
576-
* Cancel all open orders method
578+
* cancelOpenOrders - Cancel all open orders method
579+
*
580+
* @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#cancel-all-open-orders-on-a-symbol-trade
581+
*
577582
* $api->cancelOpenOrders( "BNBBTC" );
578-
* @param $symbol string the currency symbol
583+
* @param string $symbol (mandatory) the merket symbol
584+
* @param array $params (optional) an array of additional parameters that the API endpoint allows
579585
* @return array with error message or the order details
580586
* @throws \Exception
581587
*/
582-
public function cancelOpenOrders($symbol = null, array $params = [])
588+
public function cancelOpenOrders(string $symbol, array $params = [])
583589
{
584-
$request = [];
585-
if (is_null($symbol) != true) {
586-
$request = [
587-
"symbol" => $symbol,
588-
];
589-
}
590+
$request = [
591+
"symbol" => $symbol,
592+
];
590593
return $this->apiRequest("v3/openOrders", "DELETE", array_merge($request, $params), true);
591594
}
592595

0 commit comments

Comments
 (0)