Skip to content

Commit e855861

Browse files
committed
recvWindow check moved to httpRequest
1 parent 6519779 commit e855861

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

php-binance-api.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class API
6060
protected $requestCount = 0; // /< This stores the amount of API requests
6161
protected $httpDebug = false; // /< If you enable this, curl will output debugging information
6262
protected $subscriptions = []; // /< View all websocket subscriptions
63+
protected $recvWindow = null; // /< The amount of time in milliseconds to wait for a response from the server for endpoints that accept a recvWindow parameter
6364

6465
// /< value of available onOrder assets
6566

@@ -434,7 +435,7 @@ public function numberOfDecimals($val = 0.00000001)
434435
public function marketQuoteSell(string $symbol, $quantity, array $params = [])
435436
{
436437
$params['isQuoteOrder'] = true;
437-
$c = $this->numberOfDecimals($this->exchangeInfo()['symbols'][$symbol]['filters'][2]['minQty']);
438+
$c = $this->numberOfDecimals($this->exchangeInfo()['symbols'][$symbol]['filters'][1]['minQty']);
438439
$quantity = $this->floorDecimal($quantity, $c);
439440

440441
return $this->order("SELL", $symbol, $quantity, 0, "MARKET", $params);
@@ -470,7 +471,7 @@ public function marketQuoteSellTest(string $symbol, $quantity, array $params = [
470471
*/
471472
public function marketSell(string $symbol, $quantity, array $params = [])
472473
{
473-
$c = $this->numberOfDecimals($this->exchangeInfo()['symbols'][$symbol]['filters'][2]['minQty']);
474+
$c = $this->numberOfDecimals($this->exchangeInfo()['symbols'][$symbol]['filters'][1]['minQty']);
474475
$quantity = $this->floorDecimal($quantity, $c);
475476

476477
return $this->order("SELL", $symbol, $quantity, 0, "MARKET", $params);
@@ -1494,6 +1495,10 @@ protected function httpRequest(string $url, string $method = "GET", array $param
14941495
$this->downloadCurlCaBundle();
14951496
}
14961497
}
1498+
if ((!isset ($params['recvWindow'])) && (!is_null($this->recvWindow))) {
1499+
$params['recvWindow'] = $this->recvWindow;
1500+
print_r($params);
1501+
}
14971502

14981503
$base = $this->base;
14991504
if ($this->useTestnet) {
@@ -1768,7 +1773,6 @@ public function order(string $side, string $symbol, $quantity, $price, string $t
17681773
"side" => $side,
17691774
"type" => $type,
17701775
"quantity" => $quantity,
1771-
"recvWindow" => 60000,
17721776
];
17731777

17741778
// someone has preformated there 8 decimal point double already
@@ -3238,7 +3242,6 @@ public function ocoOrder(string $side, string $symbol, $quantity, $price, $stopp
32383242
$request = [
32393243
"symbol" => $symbol,
32403244
"side" => $side,
3241-
"recvWindow" => 60000,
32423245
];
32433246

32443247
if (is_numeric($quantity) === false) {

0 commit comments

Comments
 (0)