From d7c496fb7e00c4fb8ab7d2023246093622c35419 Mon Sep 17 00:00:00 2001 From: yzh-pelle <81404729+yzh-pelle@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:37:27 +0300 Subject: [PATCH 1/3] Some spot methods updated --- php-binance-api.php | 130 ++++++++++++++++++++++++++++++-------------- 1 file changed, 90 insertions(+), 40 deletions(-) diff --git a/php-binance-api.php b/php-binance-api.php index e6be222..c4254c5 100755 --- a/php-binance-api.php +++ b/php-binance-api.php @@ -148,7 +148,7 @@ public function __set(string $member, $value) * @param $file string file location * @return null */ - protected function setupApiConfigFromFile(?string $file = null) + protected function setupApiConfigFromFile(string $file = null) { $file = is_null($file) ? getenv("HOME") . "/.config/jaggedsoft/php-binance-api.json" : $file; @@ -174,7 +174,7 @@ protected function setupApiConfigFromFile(?string $file = null) * @param $file string file location * @return null */ - protected function setupCurlOptsFromFile(?string $file = null) + protected function setupCurlOptsFromFile(string $file = null) { $file = is_null($file) ? getenv("HOME") . "/.config/jaggedsoft/php-binance-api.json" : $file; @@ -197,7 +197,7 @@ protected function setupCurlOptsFromFile(?string $file = null) * * @return null */ - protected function setupProxyConfigFromFile(?string $file = null) + protected function setupProxyConfigFromFile(string $file = null) { $file = is_null($file) ? getenv("HOME") . "/.config/jaggedsoft/php-binance-api.json" : $file; @@ -613,7 +613,7 @@ public function orders(string $symbol, int $limit = 500, int $fromOrderId = 0, a * @return array with error message or array of orderDetails array * @throws \Exception */ - public function history(string $symbol, int $limit = 500, int $fromTradeId = -1, ?int $startTime = null, ?int $endTime = null, array $params = []) + public function history(string $symbol, int $limit = 500, int $fromTradeId = -1, int $startTime = null, int $endTime = null, array $params = []) { $request = [ "symbol" => $symbol, @@ -640,7 +640,7 @@ public function history(string $symbol, int $limit = 500, int $fromTradeId = -1, * @return array with error message or array of orderDetails array * @throws \Exception */ - public function myTrades(string $symbol, int $limit = 500, int $fromTradeId = -1, ?int $startTime = null, ?int $endTime = null, array $params = []) + public function myTrades(string $symbol, int $limit = 500, int $fromTradeId = -1, int $startTime = null, int $endTime = null, array $params = []) { return $this->history($symbol, $limit, $fromTradeId, $startTime, $endTime, $params); } @@ -664,6 +664,8 @@ public function useServerTime(array $params = []) /** * time Gets the server time * + * @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints + * * $time = $api->time(); * * @return array with error message or array with server time key @@ -677,7 +679,7 @@ public function time(array $params = []) /** * exchangeInfo - Gets the complete exchange info, including limits, currency options etc. * - * @link https://binance-docs.github.io/apidocs/spot/en/#exchange-information + * @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints * * $info = $api->exchangeInfo(); * $info = $api->exchangeInfo('BTCUSDT'); @@ -953,7 +955,7 @@ public function depositAddress(string $asset, $network = null, array $params = [ * @return array containing the response * @throws \Exception */ - public function depositHistory(?string $asset = null, array $params = []) + public function depositHistory(string $asset = null, array $params = []) { $request = array(); if (is_null($asset) === false) { @@ -987,7 +989,7 @@ public function depositHistory(?string $asset = null, array $params = []) * @return array containing the response * @throws \Exception */ - public function withdrawHistory(?string $asset = null, array $params = []) + public function withdrawHistory(string $asset = null, array $params = []) { $request = array(); if (is_null($asset) === false) { @@ -1212,7 +1214,7 @@ public function account(array $params = []) * @return array with error message or array of prevDay change * @throws \Exception */ - public function prevDay(?string $symbol = null, array $params = []) + public function prevDay(string $symbol = null, array $params = []) { $request = []; if (is_null($symbol) === false) { @@ -1237,14 +1239,13 @@ public function aggTrades(string $symbol, array $params = []) $request = [ "symbol" => $symbol, ]; - return $this->tradesData($this->apiRequest("v1/aggTrades", "GET", array_merge($request, $params))); + return $this->tradesData($this->apiRequest("v3/aggTrades", "GET", array_merge($request, $params))); } /** * historicalTrades - Get historical trades for a specific currency * - * @link https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#old-trade-lookup-market_data - * @link https://binance-docs.github.io/apidocs/spot/en/#old-trade-lookup + * @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints * * @property int $weight 5 * Standard weight is 5 but if no tradeId is given, weight is 1 @@ -1278,6 +1279,8 @@ public function historicalTrades(string $symbol, int $limit = 500, int $tradeId /** * depth get Market depth * + * @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints + * * $depth = $api->depth("ETHBTC"); * * @param $symbol string the symbol to get the depth information for @@ -1299,7 +1302,7 @@ public function depth(string $symbol, int $limit = 100, array $params = []) "symbol" => $symbol, "limit" => $limit, ]; - $json = $this->apiRequest("v1/depth", "GET", array_merge($request, $params)); + $json = $this->apiRequest("v3/depth", "GET", array_merge($request, $params)); if (is_array($json) === false) { echo "Error: unable to fetch depth" . PHP_EOL; $json = []; @@ -1497,6 +1500,7 @@ protected function httpRequest(string $url, string $method = "GET", array $param } if ((!isset ($params['recvWindow'])) && (!is_null($this->recvWindow))) { $params['recvWindow'] = $this->recvWindow; + print_r($params); } $base = $this->base; @@ -1829,6 +1833,8 @@ public function order(string $side, string $symbol, $quantity, $price, string $t * candlesticks get the candles for the given intervals * 1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M * + * @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints + * * $candles = $api->candlesticks("BNBBTC", "5m"); * * @param $symbol market symbol to get the response for, e.g. ETHUSDT @@ -1836,10 +1842,12 @@ public function order(string $side, string $symbol, $quantity, $price, string $t * @param $limit int limit the amount of candles * @param $startTime string request candle information starting from here * @param $endTime string request candle information ending here + * @param $params array additional parameters + * - @param string $params['timeZone'] (optional) default is 0 (UTC) - time zone to use for the response * @return array containing the response * @throws \Exception */ - public function candlesticks(string $symbol, string $interval = "5m", ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function candlesticks(string $symbol, string $interval = "5m", int $limit = null, $startTime = null, $endTime = null, array $params = []) { if (!isset($this->charts[$symbol])) { $this->charts[$symbol] = []; @@ -1862,14 +1870,14 @@ public function candlesticks(string $symbol, string $interval = "5m", ?int $limi $request["endTime"] = $endTime; } - $response = $this->apiRequest("v1/klines", "GET", array_merge($request, $params)); + $response = $this->apiRequest("v3/klines", "GET", array_merge($request, $params)); if (is_array($response) === false) { return []; } if (count($response) === 0) { - echo "warning: v1/klines returned empty array, usually a blip in the connection or server" . PHP_EOL; + echo "warning: v3/klines returned empty array, usually a blip in the connection or server" . PHP_EOL; return []; } @@ -1878,6 +1886,48 @@ public function candlesticks(string $symbol, string $interval = "5m", ?int $limi return $ticks; } + /** + * uiCandlesticks return modified kline data, optimized for presentation of candlestick charts + * 1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M + * + * @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/market-data-endpoints + * + * $candles = $api->uiCandlesticks("BNBBTC", "5m"); + * + * @param $symbol market symbol to get the response for, e.g. ETHUSDT + * @param $interval string to request + * @param $limit int limit the amount of candles + * @param $startTime string request candle information starting from here + * @param $endTime string request candle information ending here + * @param $params array additional parameters + * - @param string $params['timeZone'] (optional) default is 0 (UTC) - time zone to use for the response + * @return array containing the response + * @throws \Exception + */ + public function uiCandlesticks(string $symbol, string $interval = "5m", int $limit = null, $startTime = null, $endTime = null, array $params = []) + { + $request = [ + "symbol" => $symbol, + "interval" => $interval, + ]; + + if ($limit) { + $request["limit"] = $limit; + } + + if ($startTime) { + $request["startTime"] = $startTime; + } + + if ($endTime) { + $request["endTime"] = $endTime; + } + + $response = $this->apiRequest("v3/uiKlines", "GET", array_merge($request, $params)); + + return $response; + } + /** * balanceData Converts all your balances into a nice array * @@ -2267,7 +2317,7 @@ public function displayDepth(array $array) * @param $json array of the depth infomration * @return array of the depth information */ - protected function depthData(string $symbol, array $json, ?string $product_type = null) + protected function depthData(string $symbol, array $json, string $product_type = null) { $bids = $asks = []; foreach ($json['bids'] as $obj) { @@ -2672,7 +2722,7 @@ public function ticker($symbol, callable $callback) * @return null * @throws \Exception */ - public function chart($symbols, string $interval = "30m", ?callable $callback = null, $limit = 500) + public function chart($symbols, string $interval = "30m", callable $callback = null, $limit = 500) { if (is_null($callback)) { throw new Exception("You must provide a valid callback"); @@ -2756,7 +2806,7 @@ public function chart($symbols, string $interval = "30m", ?callable $callback = * @return null * @throws \Exception */ - public function kline($symbols, string $interval = "30m", ?callable $callback = null) + public function kline($symbols, string $interval = "30m", callable $callback = null) { if (is_null($callback)) { throw new Exception("You must provide a valid callback"); @@ -3104,7 +3154,7 @@ public function isOnTestnet() : bool /** * systemStatus - Status indicator for api sapi * - * @link https://binance-docs.github.io/apidocs/spot/en/#test-connectivity + * @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/general-endpoints * @link https://binance-docs.github.io/apidocs/spot/en/#system-status-system * @link https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api * @@ -3413,7 +3463,7 @@ public function futuresExchangeInfo(array $params = []) * @return array with error message or array of market depth * @throws \Exception */ - public function futuresDepth(string $symbol, ?int $limit = null, array $params = []) + public function futuresDepth(string $symbol, int $limit = null, array $params = []) { if (isset($symbol) === false || is_string($symbol) === false) { // WPCS: XSS OK. @@ -3458,7 +3508,7 @@ public function futuresDepth(string $symbol, ?int $limit = null, array $params = * @return array containing the response * @throws \Exception */ - public function futuresRecentTrades(string $symbol, ?int $limit = null, array $params = []) + public function futuresRecentTrades(string $symbol, int $limit = null, array $params = []) { $request = [ 'symbol' => $symbol, @@ -3517,7 +3567,7 @@ public function futuresHistoricalTrades(string $symbol, $limit = null, $tradeId * @return array with error message or array of market history * @throws \Exception */ - public function futuresAggTrades(string $symbol, ?int $fromId = null, ?int $startTime = null, ?int $endTime = null, ?int $limit = null, array $params = []) + public function futuresAggTrades(string $symbol, int $fromId = null, int $startTime = null, int $endTime = null, int $limit = null, array $params = []) { $request = [ 'symbol' => $symbol, @@ -3560,7 +3610,7 @@ public function futuresAggTrades(string $symbol, ?int $fromId = null, ?int $star * @return array containing the response * @throws \Exception */ - public function futuresCandlesticks(string $symbol, string $interval = '5m', ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function futuresCandlesticks(string $symbol, string $interval = '5m', int $limit = null, $startTime = null, $endTime = null, array $params = []) { return $this->futuresCandlesticksHelper($symbol, $interval, $limit, $startTime, $endTime, 'klines', null, $params); } @@ -3589,7 +3639,7 @@ public function futuresCandlesticks(string $symbol, string $interval = '5m', ?in * @return array containing the response * @throws \Exception */ - public function futuresContinuousCandlesticks(string $symbol, string $interval = '5m', ?int $limit = null, $startTime = null, $endTime = null, $contractType = 'PERPETUAL', array $params = []) + public function futuresContinuousCandlesticks(string $symbol, string $interval = '5m', int $limit = null, $startTime = null, $endTime = null, $contractType = 'PERPETUAL', array $params = []) { return $this->futuresCandlesticksHelper($symbol, $interval, $limit, $startTime, $endTime, 'continuousKlines', $contractType, $params); } @@ -3617,7 +3667,7 @@ public function futuresContinuousCandlesticks(string $symbol, string $interval = * @return array containing the response * @throws \Exception */ - public function futuresIndexPriceCandlesticks(string $symbol, string $interval = '5m', ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function futuresIndexPriceCandlesticks(string $symbol, string $interval = '5m', int $limit = null, $startTime = null, $endTime = null, array $params = []) { return $this->futuresCandlesticksHelper($symbol, $interval, $limit, $startTime, $endTime, 'indexPriceKlines', null, $params); } @@ -3645,7 +3695,7 @@ public function futuresIndexPriceCandlesticks(string $symbol, string $interval = * @return array containing the response * @throws \Exception */ - public function futuresMarkPriceCandlesticks(string $symbol, string $interval = '5m', ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function futuresMarkPriceCandlesticks(string $symbol, string $interval = '5m', int $limit = null, $startTime = null, $endTime = null, array $params = []) { return $this->futuresCandlesticksHelper($symbol, $interval, $limit, $startTime, $endTime, 'markPriceKlines', null, $params); } @@ -3673,7 +3723,7 @@ public function futuresMarkPriceCandlesticks(string $symbol, string $interval = * @return array containing the response * @throws \Exception */ - public function futuresPremiumIndexCandlesticks(string $symbol, string $interval = '5m', ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function futuresPremiumIndexCandlesticks(string $symbol, string $interval = '5m', int $limit = null, $startTime = null, $endTime = null, array $params = []) { return $this->futuresCandlesticksHelper($symbol, $interval, $limit, $startTime, $endTime, 'premiumIndexKlines', null, $params); } @@ -3747,7 +3797,7 @@ private function futuresCandlesticksHelper($symbol, $interval, $limit, $startTim * @return array containing the response * @throws \Exception */ - public function futuresMarkPrice(?string $symbol = null, array $params = []) + public function futuresMarkPrice(string $symbol = null, array $params = []) { $request = []; if ($symbol) { @@ -3772,7 +3822,7 @@ public function futuresMarkPrice(?string $symbol = null, array $params = []) * @return array containing the response * @throws \Exception */ - public function futuresFundingRateHistory(?string $symbol = null, ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function futuresFundingRateHistory(string $symbol = null, int $limit = null, $startTime = null, $endTime = null, array $params = []) { $request = []; if ($symbol) { @@ -3823,7 +3873,7 @@ public function futuresFundingInfo(array $params = []) * @return array containing the response * @throws \Exception */ - public function futuresPrevDay(?string $symbol = null, array $params = []) + public function futuresPrevDay(string $symbol = null, array $params = []) { $request = []; if ($symbol) { @@ -3936,7 +3986,7 @@ public function futuresPricesV2(array $params = []) * @return array containing the response * @throws \Exception */ - public function futuresSymbolOrderBookTicker(?string $symbol = null, array $params = []): array + public function futuresSymbolOrderBookTicker(string $symbol = null, array $params = []): array { $request = []; if ($symbol) { @@ -4026,7 +4076,7 @@ private function sapieriodLimitStartEndFuturesDataRequest($symbol, $period, $lim * @return array containing the response * @throws \Exception */ - public function futuresOpenInterestHistory(string $symbol, string $period = '5m', ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function futuresOpenInterestHistory(string $symbol, string $period = '5m', int $limit = null, $startTime = null, $endTime = null, array $params = []) { return $this->sapieriodLimitStartEndFuturesDataRequest($symbol, $period, $limit, $startTime, $endTime, 'openInterestHist', $params); } @@ -4047,7 +4097,7 @@ public function futuresOpenInterestHistory(string $symbol, string $period = '5m' * @return array containing the response * @throws \Exception */ - public function futuresTopLongShortPositionRatio(string $symbol, string $period = '5m', ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function futuresTopLongShortPositionRatio(string $symbol, string $period = '5m', int $limit = null, $startTime = null, $endTime = null, array $params = []) { return $this->sapieriodLimitStartEndFuturesDataRequest($symbol, $period, $limit, $startTime, $endTime, 'topLongShortPositionRatio', $params); } @@ -4068,7 +4118,7 @@ public function futuresTopLongShortPositionRatio(string $symbol, string $period * @return array containing the response * @throws \Exception */ - public function futuresTopLongShortAccountRatio(string $symbol, string $period = '5m', ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function futuresTopLongShortAccountRatio(string $symbol, string $period = '5m', int $limit = null, $startTime = null, $endTime = null, array $params = []) { return $this->sapieriodLimitStartEndFuturesDataRequest($symbol, $period, $limit, $startTime, $endTime, 'topLongShortAccountRatio', $params); } @@ -4089,7 +4139,7 @@ public function futuresTopLongShortAccountRatio(string $symbol, string $period = * @return array containing the response * @throws \Exception */ - public function futuresGlobalLongShortAccountRatio(string $symbol, string $period = '5m', ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function futuresGlobalLongShortAccountRatio(string $symbol, string $period = '5m', int $limit = null, $startTime = null, $endTime = null, array $params = []) { return $this->sapieriodLimitStartEndFuturesDataRequest($symbol, $period, $limit, $startTime, $endTime, 'globalLongShortAccountRatio', $params); } @@ -4110,7 +4160,7 @@ public function futuresGlobalLongShortAccountRatio(string $symbol, string $perio * @return array containing the response * @throws \Exception */ - public function futuresTakerLongShortRatio(string $symbol, string $period = '5m', ?int $limit = null, $startTime = null, $endTime = null, array $params = []) + public function futuresTakerLongShortRatio(string $symbol, string $period = '5m', int $limit = null, $startTime = null, $endTime = null, array $params = []) { return $this->sapieriodLimitStartEndFuturesDataRequest($symbol, $period, $limit, $startTime, $endTime, 'takerlongshortRatio', $params); } @@ -4191,7 +4241,7 @@ public function futuresIndexInfo(string $symbol, array $params = []) * @return array containing the response * @throws \Exception */ - public function futuresAssetIndex(?string $symbol = null, array $params = []) + public function futuresAssetIndex(string $symbol = null, array $params = []) { $request = []; if ($symbol) { @@ -5674,7 +5724,7 @@ public function futuresTradingStatus($symbol = null, array $params = []) * futuresDownloadId * helper for other metods for getting download id */ - protected function futuresDownloadId($startTime, $endTime, ?array $params = null, string $url = '') + protected function futuresDownloadId($startTime, $endTime, array $params = null, string $url = '') { $request = [ 'startTime' => $startTime, @@ -5688,7 +5738,7 @@ protected function futuresDownloadId($startTime, $endTime, ?array $params = null * futuresDownloadLinkByDownloadId * helper for other metods for getting download link by download id */ - protected function futuresDownloadLinkByDownloadId(string $downloadId, ?array $params = null, string $url = '') + protected function futuresDownloadLinkByDownloadId(string $downloadId, array $params = null, string $url = '') { $request = [ 'downloadId' => $downloadId, From 67b1f8c82aad65b661ee81105bc1e51530bbc49a Mon Sep 17 00:00:00 2001 From: yzh-pelle <81404729+yzh-pelle@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:38:28 +0300 Subject: [PATCH 2/3] Update BinanceLiveTests.php --- tests/BinanceLiveTests.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/BinanceLiveTests.php b/tests/BinanceLiveTests.php index a412c2e..36ca8be 100644 --- a/tests/BinanceLiveTests.php +++ b/tests/BinanceLiveTests.php @@ -317,6 +317,24 @@ public function testCandlesticksSpot() $this->assertIsNumeric($candle['takerBuyVolume']); } + public function testUiCandlesticksSpot() + { + $res = $this->spotBinance->uiCandlesticks($this->symbol, $this->interval, $this->limit); + $this->assertIsArray($res); + $candle = $res[0]; + $this->assertIsInt($candle[0]); // Kline open time + $this->assertIsNumeric($candle[1]); // Open price + $this->assertIsNumeric($candle[2]); // High price + $this->assertIsNumeric($candle[3]); // Low price + $this->assertIsNumeric($candle[4]); // Close price + $this->assertIsNumeric($candle[5]); // Volume + $this->assertIsInt($candle[6]); // Kline close time + $this->assertIsNumeric($candle[7]); // Quote asset volume + $this->assertIsInt($candle[8]); // Number of trades + $this->assertIsNumeric($candle[9]); // Taker buy base asset volume + $this->assertIsNumeric($candle[10]); // Taker buy quote asset volume + } + // could throw an error: https://github.com/ccxt/php-binance-api/actions/runs/14491775733/job/40649647274?pr=511 // public function testSystemStatusSpot() // { From 476fe57f600b029eef6cf286087a931691fba2c7 Mon Sep 17 00:00:00 2001 From: yzh-pelle <81404729+yzh-pelle@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:38:50 +0300 Subject: [PATCH 3/3] Update BinanceStaticTests.php --- tests/BinanceStaticTests.php | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/tests/BinanceStaticTests.php b/tests/BinanceStaticTests.php index 8cb3997..5fe5005 100644 --- a/tests/BinanceStaticTests.php +++ b/tests/BinanceStaticTests.php @@ -797,7 +797,7 @@ public function testSpotPrevDay() } - public function testSotAggTrades() + public function testSpotAggTrades() { try { $this->binance->aggTrades($this->symbol); @@ -805,7 +805,7 @@ public function testSotAggTrades() } catch (\Throwable $e) { } - $endpoint = "https://api.binance.com/api/v1/aggTrades?"; + $endpoint = "https://api.binance.com/api/v3/aggTrades?"; $this->assertTrue(str_starts_with(self::$capturedUrl, $endpoint)); $queryString = substr(self::$capturedUrl, strlen($endpoint)); @@ -862,7 +862,7 @@ public function testSpotDepth() } catch (\Throwable $e) { } - $endpoint = "https://api.binance.com/api/v1/depth?"; + $endpoint = "https://api.binance.com/api/v3/depth?"; $this->assertTrue(str_starts_with(self::$capturedUrl, $endpoint)); $queryString = substr(self::$capturedUrl, strlen($endpoint)); @@ -941,7 +941,7 @@ public function testSpotCandlesticks() } catch (\Throwable $e) { } - $endpoint = "https://api.binance.com/api/v1/klines?"; + $endpoint = "https://api.binance.com/api/v3/klines?"; $this->assertTrue(str_starts_with(self::$capturedUrl, $endpoint)); $queryString = substr(self::$capturedUrl, strlen($endpoint)); @@ -952,7 +952,27 @@ public function testSpotCandlesticks() $this->assertEquals($this->limit, $params['limit']); $this->assertEquals($this->startTime, $params['startTime']); $this->assertEquals($this->endTime, $params['endTime']); + } + + public function testSpotUiCandlesticks() + { + try { + $this->binance->uiCandlesticks($this->symbol, $this->interval, $this->limit, $this->startTime, $this->endTime); + + } catch (\Throwable $e) { + + } + $endpoint = "https://api.binance.com/api/v3/uiKlines?"; + $this->assertTrue(str_starts_with(self::$capturedUrl, $endpoint)); + $queryString = substr(self::$capturedUrl, strlen($endpoint)); + parse_str($queryString, $params); + + $this->assertEquals($this->symbol, $params['symbol']); + $this->assertEquals($this->interval, $params['interval']); + $this->assertEquals($this->limit, $params['limit']); + $this->assertEquals($this->startTime, $params['startTime']); + $this->assertEquals($this->endTime, $params['endTime']); } public function testSpotAccountSnapshot()