Skip to content

Commit 0d4bd41

Browse files
authored
Expect an empty array for account balances
With a new Binance account, the API returns an empty array for the `balances`. This causes some misleading error messages to be shown, saying things about `useServerTime()` and faulty credentials.
1 parent 22c7b8d commit 0d4bd41

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

php-binance-api.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,9 @@ public function balances($priceData = false)
832832
echo "Error: unable to fetch your account details" . PHP_EOL;
833833
}
834834

835-
if (isset($account['balances']) === false) {
835+
if (isset($account['balances']) === false || empty($account['balances'])) {
836836
echo "Error: your balances were empty or unset" . PHP_EOL;
837+
return [];
837838
}
838839

839840
return $this->balanceData($account, $priceData);

0 commit comments

Comments
 (0)