Skip to content

Commit e2c432d

Browse files
author
David O Neill
committed
Fix source formatting
1 parent 5b58e39 commit e2c432d

1 file changed

Lines changed: 26 additions & 19 deletions

File tree

php-binance-api.php

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,11 @@ public function exchangeInfo()
504504
{
505505
return $this->httpRequest("v1/exchangeInfo");
506506
}
507-
508-
public function assetDetail() {
507+
508+
public function assetDetail()
509+
{
509510
$params["wapi"] = true;
510-
return $this -> httpRequest("v3/assetDetail.html", 'GET', $params, true);
511+
return $this->httpRequest("v3/assetDetail.html", 'GET', $params, true);
511512
}
512513

513514
/**
@@ -617,7 +618,7 @@ public function withdrawHistory(string $asset = null, array $params = [])
617618
public function withdrawFee(string $asset)
618619
{
619620
$params = [
620-
"wapi" => true
621+
"wapi" => true,
621622
];
622623

623624
$response = $this->httpRequest("v3/assetDetail.html", "GET", $params, true);
@@ -727,17 +728,19 @@ public function aggTrades(string $symbol)
727728
* @return array with error message or array of market depth
728729
* @throws \Exception
729730
*/
730-
public function depth(string $symbol, int $limit=100)
731+
public function depth(string $symbol, int $limit = 100)
731732
{
732-
if (is_int($limit) === false)
733-
$limit = 100;
733+
if (is_int($limit) === false) {
734+
$limit = 100;
735+
}
736+
734737
if (isset($symbol) === false || is_string($symbol) === false) {
735738
// WPCS: XSS OK.
736739
echo "asset: expected bool false, " . gettype($symbol) . " given" . PHP_EOL;
737740
}
738741
$json = $this->httpRequest("v1/depth", "GET", [
739742
"symbol" => $symbol,
740-
"limit" => $limit,
743+
"limit" => $limit,
741744
]);
742745
if (isset($this->info[$symbol]) === false) {
743746
$this->info[$symbol] = [];
@@ -889,10 +892,12 @@ private function httpRequest(string $url, string $method = "GET", array $params
889892
}
890893
$query = http_build_query($params, '', '&');
891894
$signature = hash_hmac('sha256', $query, $this->api_secret);
892-
if ($method === "POST") {
893-
$endpoint = $base . $url . '?' . 'signature=' . $signature;
894-
} else
895-
$endpoint = $base . $url . '?' . $query . '&signature=' . $signature;
895+
if ($method === "POST") {
896+
$endpoint = $base . $url . '?' . 'signature=' . $signature;
897+
} else {
898+
$endpoint = $base . $url . '?' . $query . '&signature=' . $signature;
899+
}
900+
896901
curl_setopt($curl, CURLOPT_URL, $endpoint);
897902
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
898903
'X-MBX-APIKEY: ' . $this->api_key,
@@ -1514,31 +1519,33 @@ private function depthData(string $symbol, array $json)
15141519
"asks" => $asks,
15151520
];
15161521
}
1517-
1522+
15181523
/**
15191524
* roundStep rounds quantity with stepSize
15201525
* @param $qty quantity
15211526
* @param $stepSize parameter from exchangeInfo
15221527
* @return rounded value. example: roundStep(1.2345, 0.1) = 1.2
15231528
*
15241529
*/
1525-
public function roundStep($qty, $stepSize = 0.1) {
1526-
$precision = strlen(substr(strrchr(rtrim($stepSize,'0'), '.'), 1));
1530+
public function roundStep($qty, $stepSize = 0.1)
1531+
{
1532+
$precision = strlen(substr(strrchr(rtrim($stepSize, '0'), '.'), 1));
15271533
return round((($qty / $stepSize) | 0) * $stepSize, $precision);
15281534
}
1529-
1535+
15301536
/**
15311537
* roundTicks rounds price with tickSize
15321538
* @param $value price
15331539
* @param $tickSize parameter from exchangeInfo
15341540
* @return rounded value. example: roundStep(1.2345, 0.1) = 1.2
15351541
*
15361542
*/
1537-
public function roundTicks($price, $tickSize) {
1538-
$precision = strlen(rtrim(substr($tickSize,strpos($tickSize, '.', 1) + 1), '0'));
1543+
public function roundTicks($price, $tickSize)
1544+
{
1545+
$precision = strlen(rtrim(substr($tickSize, strpos($tickSize, '.', 1) + 1), '0'));
15391546
return number_format($price, $precision, '.', '');
15401547
}
1541-
1548+
15421549
/**
15431550
* getTransfered gets the total transfered in b,Kb,Mb,Gb
15441551
*

0 commit comments

Comments
 (0)