From 957c6b0bf5b5abf13f6609cb54b018b54a7b7cdd Mon Sep 17 00:00:00 2001 From: ePascalC Date: Sat, 21 Aug 2021 17:11:44 +0200 Subject: [PATCH] Future and Margin preparation Add fapi and bapi --- php-binance-api.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/php-binance-api.php b/php-binance-api.php index 81ba80ae..500f9ae9 100755 --- a/php-binance-api.php +++ b/php-binance-api.php @@ -33,6 +33,8 @@ class API protected $baseTestnet = 'https://testnet.binance.vision/api/'; // /< Testnet REST endpoint for the currency exchange protected $wapi = 'https://api.binance.com/wapi/'; // /< REST endpoint for the withdrawals protected $sapi = 'https://api.binance.com/sapi/'; // /< REST endpoint for the supporting network API + protected $fapi = 'https://fapi.binance.com/'; // /< REST endpoint for the futures API + protected $bapi = 'https://www.binance.com/bapi/'; // /< REST endpoint for the internal Binance API protected $stream = 'wss://stream.binance.com:9443/ws/'; // /< Endpoint for establishing websocket connections protected $streamTestnet = 'wss://testnet.binance.vision/ws/'; // /< Testnet endpoint for establishing websocket connections protected $api_key; // /< API key that you created in the binance website member area @@ -1272,7 +1274,16 @@ protected function httpRequest(string $url, string $method = "GET", array $param unset($params['sapi']); $base = $this->sapi; } - + + if (isset($params['fapi'])) { + unset($params['fapi']); + $base = $this->fapi; + } + + if (isset($params['bapi'])) { + unset($params['bapi']); + $base = $this->bapi; + } $query = $this->binance_build_query($params); $query = str_replace([ '%40' ], [ '@' ], $query);//if send data type "e-mail" then binance return: [Signature for this request is not valid.] $signature = hash_hmac('sha256', $query, $this->api_secret);