@@ -1448,24 +1448,27 @@ protected function curl_set_body($curl, $option, $query) {
1448
1448
curl_setopt ($ curl , $ option , $ query );
1449
1449
}
1450
1450
1451
- protected function spotRequest ($ url , $ method = "GET " , $ params = [], $ signed = false )
1451
+ public function spotRequest ($ url , $ method = "GET " , $ params = [], $ signed = false )
1452
1452
{
1453
1453
return $ this ->httpRequest ($ url , $ method , $ params , $ signed );
1454
1454
}
1455
1455
1456
- protected function spotWalletRequest ($ url , $ method = "GET " , $ params = [], $ signed = false )
1456
+ public function spotWalletRequest ($ url , $ method = "GET " , $ params = [], $ signed = false )
1457
1457
{
1458
1458
$ params ['sapi ' ] = true ;
1459
1459
return $ this ->httpRequest ($ url , $ method , $ params , $ signed );
1460
1460
}
1461
1461
1462
- protected function futuresRequest ($ url , $ method = "GET " , $ params = [], $ signed = false )
1462
+ public function futuresRequest ($ url , $ method = "GET " , $ params = [], $ signed = false , $ recvWindow = null )
1463
1463
{
1464
1464
$ params ['fapi ' ] = true ;
1465
+ if ($ recvWindow ) {
1466
+ $ params ['recvWindow ' ] = $ recvWindow ;
1467
+ }
1465
1468
return $ this ->httpRequest ($ url , $ method , $ params , $ signed );
1466
1469
}
1467
1470
1468
- protected function fapiDataRequest ($ url , $ method = "GET " , $ params = [], $ signed = false )
1471
+ public function fapiDataRequest ($ url , $ method = "GET " , $ params = [], $ signed = false )
1469
1472
{
1470
1473
$ params ['fapiData ' ] = true ;
1471
1474
return $ this ->httpRequest ($ url , $ method , $ params , $ signed );
@@ -3360,9 +3363,9 @@ public function bswapQuote($baseAsset, $quoteAsset, $quoteQty, array $params = [
3360
3363
* @return array with error message or array with server time key
3361
3364
* @throws \Exception
3362
3365
*/
3363
- public function futuresTime ()
3366
+ public function futuresTime (array $ params = [] )
3364
3367
{
3365
- return $ this ->futuresRequest ("v1/time " , "GET " );
3368
+ return $ this ->futuresRequest ("v1/time " , "GET " , $ params );
3366
3369
}
3367
3370
3368
3371
/**
@@ -3377,10 +3380,10 @@ public function futuresTime()
3377
3380
* @return array containing the response
3378
3381
* @throws \Exception
3379
3382
*/
3380
- public function futuresExchangeInfo ()
3383
+ public function futuresExchangeInfo (array $ params = [] )
3381
3384
{
3382
3385
if (!$ this ->futuresExchangeInfo ) {
3383
- $ arr = $ this ->futuresRequest ("v1/exchangeInfo " , "GET " );
3386
+ $ arr = $ this ->futuresRequest ("v1/exchangeInfo " , "GET " , $ params );
3384
3387
if ((is_array ($ arr ) === false ) || empty ($ arr )) {
3385
3388
echo "Error: unable to fetch futures exchange info " . PHP_EOL ;
3386
3389
$ arr = array ();
@@ -3415,21 +3418,20 @@ public function futuresExchangeInfo()
3415
3418
* @return array with error message or array of market depth
3416
3419
* @throws \Exception
3417
3420
*/
3418
- public function futuresDepth (string $ symbol , int $ limit = null )
3421
+ public function futuresDepth (string $ symbol , int $ limit = null , array $ params = [] )
3419
3422
{
3420
3423
if (isset ($ symbol ) === false || is_string ($ symbol ) === false ) {
3421
3424
// WPCS: XSS OK.
3422
3425
echo "asset: expected bool false, " . gettype ($ symbol ) . " given " . PHP_EOL ;
3423
3426
}
3424
3427
3425
- $ params = [
3428
+ $ request = [
3426
3429
'symbol ' => $ symbol ,
3427
- 'fapi ' => true ,
3428
3430
];
3429
3431
if ($ limit ) {
3430
- $ params ['limit ' ] = $ limit ;
3432
+ $ request ['limit ' ] = $ limit ;
3431
3433
}
3432
- $ json = $ this ->httpRequest ("v1/depth " , "GET " , $ params );
3434
+ $ json = $ this ->futuresRequest ("v1/depth " , "GET " , array_merge ( $ request , $ params) );
3433
3435
if (is_array ($ json ) === false ) {
3434
3436
echo "Error: unable to fetch futures depth " . PHP_EOL ;
3435
3437
$ json = [];
@@ -3461,16 +3463,15 @@ public function futuresDepth(string $symbol, int $limit = null)
3461
3463
* @return array containing the response
3462
3464
* @throws \Exception
3463
3465
*/
3464
- public function futuresRecentTrades (string $ symbol , int $ limit = null )
3466
+ public function futuresRecentTrades (string $ symbol , int $ limit = null , array $ params = [] )
3465
3467
{
3466
- $ parameters = [
3468
+ $ request = [
3467
3469
'symbol ' => $ symbol ,
3468
- 'fapi ' => true ,
3469
3470
];
3470
3471
if ($ limit ) {
3471
- $ parameters ['limit ' ] = $ limit ;
3472
+ $ request ['limit ' ] = $ limit ;
3472
3473
}
3473
- return $ this ->httpRequest ("v1/trades " , "GET " , $ parameters );
3474
+ return $ this ->futuresRequest ("v1/trades " , "GET " , array_merge ( $ request , $ params ) );
3474
3475
}
3475
3476
3476
3477
/**
@@ -3489,19 +3490,18 @@ public function futuresRecentTrades(string $symbol, int $limit = null)
3489
3490
* @return array containing the response
3490
3491
* @throws \Exception
3491
3492
*/
3492
- public function futuresHistoricalTrades (string $ symbol , int $ limit = null , int $ tradeId = null )
3493
+ public function futuresHistoricalTrades (string $ symbol , $ limit = null , $ tradeId = null , array $ params = [] )
3493
3494
{
3494
- $ parameters = [
3495
+ $ request = [
3495
3496
'symbol ' => $ symbol ,
3496
- 'fapi ' => true ,
3497
3497
];
3498
3498
if ($ limit ) {
3499
- $ parameters ['limit ' ] = $ limit ;
3499
+ $ request ['limit ' ] = $ limit ;
3500
3500
}
3501
3501
if ($ tradeId ) {
3502
- $ parameters ['fromId ' ] = $ tradeId ;
3502
+ $ request ['fromId ' ] = $ tradeId ;
3503
3503
}
3504
- return $ this ->httpRequest ("v1/historicalTrades " , "GET " , $ parameters , true );
3504
+ return $ this ->futuresRequest ("v1/historicalTrades " , "GET " , array_merge ( $ request , $ params ) , true );
3505
3505
}
3506
3506
3507
3507
/**
@@ -3522,25 +3522,24 @@ public function futuresHistoricalTrades(string $symbol, int $limit = null, int $
3522
3522
* @return array with error message or array of market history
3523
3523
* @throws \Exception
3524
3524
*/
3525
- public function futuresAggTrades (string $ symbol , int $ fromId = null , int $ startTime = null , int $ endTime = null , int $ limit = null )
3525
+ public function futuresAggTrades (string $ symbol , int $ fromId = null , int $ startTime = null , int $ endTime = null , int $ limit = null , array $ params = [] )
3526
3526
{
3527
- $ parameters = [
3527
+ $ request = [
3528
3528
'symbol ' => $ symbol ,
3529
- 'fapi ' => true ,
3530
3529
];
3531
3530
if ($ fromId ) {
3532
- $ parameters ['fromId ' ] = $ fromId ;
3531
+ $ request ['fromId ' ] = $ fromId ;
3533
3532
}
3534
3533
if ($ startTime ) {
3535
- $ parameters ['startTime ' ] = $ startTime ;
3534
+ $ request ['startTime ' ] = $ startTime ;
3536
3535
}
3537
3536
if ($ endTime ) {
3538
- $ parameters ['endTime ' ] = $ endTime ;
3537
+ $ request ['endTime ' ] = $ endTime ;
3539
3538
}
3540
3539
if ($ limit ) {
3541
- $ parameters ['limit ' ] = $ limit ;
3540
+ $ request ['limit ' ] = $ limit ;
3542
3541
}
3543
- return $ this ->tradesData ($ this ->httpRequest ("v1/aggTrades " , "GET " , $ parameters ));
3542
+ return $ this ->tradesData ($ this ->futuresRequest ("v1/aggTrades " , "GET " , array_merge ( $ request , $ params ) ));
3544
3543
}
3545
3544
3546
3545
/**
0 commit comments