Skip to content

Commit 157cfb6

Browse files
authored
balances(): estimate your USDT value
1 parent 70afb03 commit 157cfb6

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

php-binance-api.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,14 @@ private function balanceData(array $array, $priceData)
12011201
$btc_value += $obj['free'];
12021202
$btc_total += $obj['free'] + $obj['locked'];
12031203
continue;
1204+
} elseif ( $asset === 'USDT' || $asset === 'USDC' || $asset === 'PAX' || $asset === 'BUSD' ) {
1205+
$btcValue = $obj['free'] / $priceData['BTCUSDT'];
1206+
$btcTotal = ($obj['free'] + $obj['locked']) / $priceData['BTCUSDT'];
1207+
$balances[$asset]['btcValue'] = $btcValue;
1208+
$balances[$asset]['btcTotal'] = $btcTotal;
1209+
$btc_value += $btcValue;
1210+
$btc_total += $btcTotal;
1211+
continue;
12041212
}
12051213

12061214
$symbol = $asset . 'BTC';

0 commit comments

Comments
 (0)